strcoll() ফাংশন দুটি স্ট্রিং লোকেল-স্পেসিফিক কলেটিং সিকোয়েন্স ব্যবহার করে তুলনা করতে ব্যবহৃত হয়।
এটি রিটার্ন করে −
- শূন্য, যখন দুটি স্ট্রিং একই,
- শূন্য থেকে বড় মান যখন প্রথম স্ট্রিং অন্যটির চেয়ে বড়
- শূন্য থেকে ছোট মান, যখন প্রথম স্ট্রিং অন্যটির চেয়ে ছোট।
সি ভাষায় strcoll()-এর সিনট্যাক্স:
int strcoll(const char *first_string, const char *second_string);
সি ভাষায় 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