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

strcmp

strcmp( 
t_string1 
t_string2 
) 
=> 1 / 0 / -1

Description

Compares two argument strings alphabetically.

Compares the two argument strings t_string1 and t_string2 and returns an integer greater than, equal to, or less than zero depending on whether t_string1 is alphabetically greater, equal to, or less than t_string2. To test if the contents of two strings are the same, use the equal function.

Arguments

t_string1

First string to be compared.

t_string2

Second string to be compared.

Value Returned

1

t_string1 is alphabetically greater than t_string2.

0

t_string1 is alphabetically equal to t_string2.

-1

t_string1 is alphabetically less than t_string2.

Examples

strcmp( "abc" "abb" )    
=> 1
strcmp( "abc" "abc")  
=> 0
strcmp( "abc" "abd")  
=> -1

Related Topics

String Functions

strncmp


Return to top
 ⠀
X