Name

strcoll
- compare two strings using the current locale

Library

libc.lib

Synopsis

  #include <string.h>
  int strcoll (const char *s1, const char *s2);

Detailed description

The strcoll function lexicographically compares the null-terminated strings s1 and s2 according to the current locale collation if any, otherwise call strcmp, and returns an integer greater than, equal to, or less than 0, according as s1 is greater than, equal to, or less than s2.

Examples

#include <string.h>
#include <stdio.h>
#include <locale.h>
int main()
{
    int res;
    setlocale(LC_ALL,"ar_AE.ISO-8859-6");
    if(strcoll("abcde","abcde")==0)
       printf("Strings are same\n");
    return 0;
}

         

Output

Strings are same

         

Return value

The strcoll() function returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2, when both are interpreted as appropriate for the current locale.

See also

setlocale, strcmp, strxfrm, wcscoll

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top