strncoll

Compares two strings, according to the LC_COLLATE category setting of the code page currently in use.

Library:LibC
Classification:Other
Service:Characters and Strings

Syntax

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

Parameters

s1

(IN) Points to a null-terminated string to compare.

s2

(IN) Points to a null-terminated string to compare.

n

(IN) Specifies the number of bytes to compare.

Return Values

Returns 0 if the two strings match. Otherwise, it returns an integer less than or greater than 0, depending on whether s1 is lexicographically less than or greater than s2.

Remarks

The strncoll function compares two strings until the n character in the s1 string is reached. The comparison uses the collating sequence selected by setlocale. The function is equivalent to strcmp when the collating sequence is selected from the ā€œCā€ locale.

See Also

strcmp