strcoll() 함수는 로케일 특정 조합 순서를 사용하여 두 문자열을 비교하는 데 사용됩니다.
그것은 반환 -
- 0, 두 문자열이 동일한 경우
- 첫 번째 문자열이 다른 문자열보다 큰 경우 값이 0보다 큼
- 0보다 작은 값, 첫 번째 문자열이 다른 문자열보다 작은 경우
다음은 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