strcoll
raw OCR
Compares two strings.
Defined in header <string.h>
Syntax
#include <string.h>
int strcolKchar *sl, char *s2);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ |
Remarks
strcoll compares the string pointed to by si to the string pointed to by s2, according to the collating sequence set by setlocale.
Return value
strcoll returns a value that is
< 0 if si is less than s2 =- 0 if si is the same as s2 > 0 if s2 is greater than s2
See also
Example
#include <stdio.h>
#include <string.h>
int main(void)
{-
char *two = "International";
char *one = "Borland";
int check;
check = strcoll (one, two);
if (check == 0)
printf("The strings are equal\n");
if (check < 0)
printf("%s comes before %s\n", one, two);
if (check > 0)
printf("%s comes before %s\n", two, one);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/string.h/strcoll/
· short form /3.1/strcoll/