strcoll
strcoll is a function in the C standard library used to compare two null-terminated strings according to the collation order of the current locale. It is declared in string.h with the signature int strcoll(const char *s1, const char *s2). The function returns a negative value if s1 is before s2, zero if they are considered equivalent, and a positive value if s1 is after s2 within the locale’s sorting rules. The exact return value is implementation-defined beyond the sign.
Locale dependence is the defining characteristic of strcoll. The comparison uses the LC_COLLATE category of the
Locale scope and thread considerations are important. In many C libraries, the process-wide locale affects strcoll;
Related functionality includes strxfrm, which produces a transformation of a string suitable for efficient comparison, enabling