[Previous]
[Contents]
[Next]

strcoll()

compare two strings, using the locale's collating sequence

Synopsis:

#include <string.h>

int strcoll( const char *s1, const char *s2 );

Description:

The strcoll() function compares the string pointed to by s1 to the string pointed to by s2. The comparison uses the collating sequence selected by the setlocale() function. The function is equivalent to the strcmp() function when the collating sequence is selected from the "C" locale.

Returns:

Value Meaning
< 0 s1 is less than s2
0 s1 is equal to s2
> 0 s1 is greater than s2

Examples:

#include <stdio.h>
#include <string.h>

char buffer[80] = "world";

void main()
  {
    if( strcoll( buffer, "Hello" ) < 0 ) {
      printf( "Less than\n" );
    }
  }

Classification:

ANSI

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

setlocale(), strcmp(), strncmp()


[Previous]
[Contents]
[Next]