wcscoll() function in C++ compares two null-terminated string. The comparison is based on the current locale defined by the LC_COLLATE category.
This function starts comparing the first character of each string. They are considered as equal until the characters differ or until a null wide character signaling the end of a string is reached.
int wcscoll( const wchar_t* wcs1, const wchar_t* wcs2 )
Parameters: The function accepts two mandatory parameters which are described below:
- wcs1: It is a pointer to the null terminated wide strings to compare.
- wcs2: It is a pointer to the null terminated wide strings to compare.
Return value : The function returns three value as below:
- 0, if values indicates that both strings are equal.
- Positive value, if the first character that is different in wcs1 is greater than the corresponding character in wcs2.
- Negative value, if the first character that is different in wcs1 is less than the corresponding character in wcs2.
Below programs illustrate the above function:
Program 1 :
In American : article precedes everyone In Swedish : article precedes everyone
Program 2 :
In Czech : geekforgeeks precedes gfg In the American locale: geekforgeeks precedes gfg
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- fma() function in C++
- div() function in C++
- log() function in C++
- exp() function C++
- wcstoul() function in C/C++
- fegetexceptflag() function in C/C++
- wcsncat() function in C/C++
- vswprintf() function in C/C++
- wcrtomb() function in C/C++
- wmemchr() function in C/C++
- wmemcmp() function in C/C++
- wctob() function in C++
- Modulus function in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.