.TH strcoll() "" "" "String Function (libc)"
.PC "Compare two strings, using locale-specific information"
.B "#include <string.h>"
\fBint strcoll(\fIstring1\^\fB, \fIstring2\^\fB)\fR
\fBchar *\fIstring1\^\fB; char *\fIstring2\^\fB;\fR
.PP
.II "string, compare two"
.II "compare two strings"
.B strcoll()
lexicographically compares the string pointed to by
.I string1
with one pointed to by
.IR string2 .
Comparison ends when a null character is read.
.PP
.B strcoll()
compares the two strings character by character until it
finds a pair of characters that are not identical.
It returns a number less than zero if the character in
.I string1
is less (i.e., occurs earlier in the character table)
than its counterpart in
.IR string2 .
It returns a number greater than zero if the character in
.I string1
is greater (i.e., occurs later in the character table)
than its counterpart in
.IR string2 .
If no characters are found to differ, then the strings are identical and
.B strcoll()
returns zero.
.SH "See Also"
.Xr "libc," libc
.Xr "localization," localizat
.Xr "string.h" string.h
.br
\*(AS, \(sc7.11.4.3
.SH Notes
The string-comparison routines
.BR strcoll() ,
.BR strcmp() ,
and
.B strncmp()
differ from the memory-comparison routine
.B memcmp()
in that they compare strings rather than regions of memory.
They stop when they encounter a null character, but
.B memcmp()
does not.
.PP
.B strcoll()
differs from
.B strcmp()
and similar functions in that it reads the user's locale, as set by a call
to function
.BR setlocale() ,
to determine the lexicographic value of each character.
For details, see the Lexicon entry for
.BR localization .
.\".PP
.\"The \*(AS's description of
.\".B strcoll()
.\"emphasizes that it uses locale-specific information, as set by the
.\"ANSI function
.\".BR setlocale() ,
.\"to perform string comparisons.
.\"The \*(CO system has not yet implement ANSI locales; therefore,
.\".B strcoll()
.\"does not differ significantly from
.\".BR strcmp() .
.\"It is included to support programs written in ANSI C.
