strncmp, strnicmp
strncmp, strnicmp — compare two strings and return a numeric result.
strncmp (string1, string2, length)
strnicmp (string1, string2, length)
string1The first string.
string2The second string.
lengthThe maximum length of the comparison.
An integer < 0 if string1 is lexically less
than string2 to the given length; 0 if the two
strings are equal up to the given length; and an integer > 0 if
string1 is lexically greater than
string2 up to the given length.
The strncmp function compares two strings and
returns a numeric result indicating whether the first string is lexically
less than, greater than, or equal to the second string. The comparison will
carry on for not more than length characters of the
shorter string. The strnicmp function is the
case-insensitive version of strncmp.
Gamma>strncmp("hello","helicopter",4);3Gamma>strncmp("hello","help",3);0Gamma>strncmp("Hello","help", 3);-32Gamma>strnicmp("Hello","help", 3);0Gamma>