फ़ंक्शन strcoll() का उपयोग लोकेल - विशिष्ट कोलाटिंग अनुक्रम का उपयोग करके दो स्ट्रिंग्स की तुलना करने के लिए किया जाता है।
यह लौटता है -
- शून्य, जब दोनों तार समान हों,
- शून्य से अधिक मान जब पहली स्ट्रिंग दूसरे से बड़ी हो
- शून्य से कम मान, जब पहली स्ट्रिंग दूसरे से कम हो।
यहाँ C भाषा में strcoll() का सिंटैक्स दिया गया है,
int strcoll(const char *first_string, const char *second_string);
यहाँ C भाषा में strcoll() का एक उदाहरण दिया गया है,
उदाहरण
#include <stdio.h>
#include <string.h>
int main () {
const char s1[] = "Helloworld";
const char s2[] = "Blank";
char *result;
result = strcoll(s1, s2);
if(result > 0)
printf("String s1 is greater than string s2");
else if(result < 0)
printf("String s1 is less than string s2");
else
printf(" Strings are not same");
return(0);
} आउटपुट
String s1 is greater than string s2