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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Function Overloading vs Function Overriding in C++
- How to call some function before main() function in C++?
- How to call function within function in C or C++
- Difference between user defined function and library function in C/C++
- Function overloading and return type
- Function Pointer in C
- Function overloading and const keyword
- Function Overloading and float in C++
- Extra brackets with function names in C/C++
- Function Interposition in C with an example of user defined malloc()
- A C/C++ Function Call Puzzle
- std::tuple, std::pair | Returning multiple values from a function using Tuple and Pair in C++
- Function Overloading in C++
- strtoul() function in C/C++
- wcscspn() function in C/C++
- asctime() function in C++
- atanh() function in C++ STL
- vector rbegin() and rend() function in C++ STL
- wcschr() function in C++
- unordered_multimap begin() and end() function in C++ STL