COHERENT manpages

This page displays the COHERENT manpage for strcoll() [Compare two strings, using locale-specific information].

List of available manpages
Index


strcoll() -- String Function (libc)

Compare two strings, using locale-specific information
#include <string.h>
int strcoll(string1, string2)
char *string1; char *string2;

strcoll() lexicographically compares  the string pointed to by string1 with
one pointed to by string2. Comparison ends when a null character is read.

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  string1 is  less (i.e.,  occurs earlier  in the
character  table) than  its  counterpart in  string2. It  returns a  number
greater  than zero  if the  character in string1  is greater  (i.e., occurs
later  in the  character  table) than  its  counterpart in  string2. If  no
characters  are  found  to  differ,  then  the strings  are  identical  and
strcoll() returns zero.

See Also

libc,
localization,
string.h
ANSI Standard, §7.11.4.3

Notes

The  string-comparison routines strcoll(),  strcmp(), and  strncmp() differ
from the  memory-comparison routine memcmp()  in that they  compare strings
rather  than regions  of  memory.  They  stop  when they  encounter a  null
character, but memcmp() does not.

strcoll() differs from strcmp() and  similar functions in that it reads the
user's locale, as  set by a call to function  setlocale(), to determine the
lexicographic value of each  character.  For details, see the Lexicon entry
for localization.