Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

alphaNumCmp

alphaNumCmp( 
S_arg1 
S_arg2 
[ g_arg3 ] 
) 
=> 1 / 0 / -1

Description

Compares two string or symbol names alphanumerically or numerically.

If the third optional argument is non-nil and the first two arguments are strings holding purely numeric values, then a numeric comparison is performed on the numeric representation of the strings.

Arguments

S_arg1

First string or symbol to compare.

S_arg2

String or symbol to compare against S_arg1.

g_arg3

If non-nil, can cause a numeric comparison of S_arg1 and S_arg2 depending whether those arguments are strings holding purely numeric values.

Value Returned

1

If S_arg1 is alphanumerically greater than S_arg2

0

If S_arg1 is alphanumerically identical to S_arg2.

-1

If S_arg2 is alphanumerically greater than S_arg1.

Examples

alphaNumCmp( "a" "b" )               
=> -1
alphaNumCmp( "b" "a" )               
=> 1
alphaNumCmp( "name12" "name12" )     
=> 0
alphaNumCmp( "name23" "name12" )     
=> 1
alphaNumCmp( "00.09" "9.0E-2" t)     
=> 0

Related Topics

strcmp

strncmp


Return to top
 ⠀
X