Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
strcoll - compare strings using collating sequence
&pagelevel(4)&pagelevel
Syntax | #include <string.h> int strcoll(const char *s1, const char *s2); |
Description | strcoll() returns an integer greater than, equal to, or less than 0, depending on whether string s1 is greater than, equal to, or less than string s2, respectively. The strings are compared on the basis of the setting for the LC_COLLATE category of the current locale (see setlocale()).
strcoll() and strxfrm() can be used to sort strings based on the environment. strcoll() is intended for applications in which the number of comparisons per string is low. If strings are to be compared frequently, strxfrm() should be used together with strcmp() in a manner that allows the transformation process to be performed just once.
|
Return val. | Integer value: |
< 0 = 0 > 0 | s1 is lexically less than s2. s1 and s2 are lexically equal. s1 is lexically greater than s2. |
Errors | strcoll() will fail if:
|
EINVAL
| The s1 or s2 arguments contain characters outside the domain of the collating sequence. |
Notes | Strings terminated with the null byte (\0 ) are expected as arguments. Since strcoll() has no return value to indicate an error, errors can only be detected as follows: by setting errno to 0, calling the function, and then checking errno after the function returns. If errno is not equal to 0, it can be assumed that an error occurred. |
See also | setlocale() , strcmp() , strxfrm() , string.h .
|