strnicoll

Microsoft-specific C function - not part of ANSI C

Syntax

int strnicoll(const char* s1, const char* s2, int n)

Arguments

s1
Pointer to the string to compare.
s2
Pointer to the string to which the first string is compared to.
n
The maximum number of characters to compare.

Return

An integer value indicating the result of the comparison.

Description

Compares two strings, up to the n maximum number of characters, based on the rules of the current system locale, in a case-insensitive manner.
If zero is returned, both strings are identical. If a negative value is returned, string s1 is found to be less then s2. If a value positive and greater then zero is returned, string s1 is greater than s2.
Characters are compared by their locale collation order - that is, the dictionary order for the locale. So while in extended ASCII accented characters come after all a-z characters, in a French locale the accented characters are in their dictionary order for the string comparison.
strnicoll is regarded as safer than strcoll, because it can help prevent buffer overflows (that could occur if a string is not null-terminated) if the n maximum number of characters is correctly to set to the size of the string memory buffers or less.
The FM function strncoll is just a wrapper around the Microsoft-specific [_strnicoll] function.

See Also

strcmp, stricoll, strncoll, strnicoll