strcmp
expression function
Compares two strings.
Usage
strcmp(s1, s2)
-
Returns a negative number if s1 is lexicographically less than s2
-
Returns a positive number if s1 is lexicographically greater than s2
-
Returns 0 if s1 is equal to s2
This function is case-sensitive. For case-insensitive comparison, use strcasecmp.
Examples
strcmp("abc", "xyz") = -1
strcmp("xyz, "abc") = 1
strcmp("abc", "abc") = 0