strnicmp
Compares, with case insensitivity, a specified number of characters in one string to another string
#include <string.h> int strnicmp ( const char *s1, const char *s2, size_t len);
The strnicmp function returns an integer less than, equal to, or greater than 0, indicating that the string pointed to by s1 is less than, equal to, or greater than the string pointed to by s2.
The strnicmp function compares, with case insensitivity, the string pointed to by s1 to the string pointed to by s2, for at most len characters.
#include <string.h> #include <stdio.h> main () { printf ("%d\n", strnicmp ("abcdef", "ABCXXX", 10) ); printf ("%d\n", strnicmp ("abcdef", "ABCXXX", 6) ); printf ("%d\n", strnicmp ("abcdef", "ABCXXX", 3) ); printf ("%d\n", strnicmp ("abcdef", "ABCXXX", 0) ); }
produces the following:
-20 -20 0 0