int r = strnicmp(const char *s1, const char *s2, size_t n);
n
bytes in strings s1
and s2
in a case-insensitive way.
If a NULL
character is encountered in either string before reaching n
bytes,
the comparison is stopped. Both strings must be valid UTF-8 strings.
If s1
is less than s2
, -1 is returned. If s1
is greater than s2
, 1 is returned,
otherwise the return value is 0.
Note that n
must be specified in bytes, not in characters.
Note that this function is mostly useful for checking the equality of two strings in a case-insensitive way. It is not appropriate for sorting because it currently doesn't handle all intricacies of Unicode collation. If you need to compare strings for sorting, please use hw_CompareString() instead. See hw_CompareString for details.