GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::strcoll(3) C++ Standard Libary std::strcoll(3)

std::strcoll - std::strcoll


Defined in header <cstring>
int strcoll( const char* lhs, const char* rhs );


Compares two null-terminated byte strings according to the current locale as defined
by the LC_COLLATE category.


lhs, rhs - pointers to the null-terminated byte strings to compare


Negative value if lhs is less than (precedes) rhs.


0 if lhs is equal to rhs.


Positive value if lhs is greater than (follows) rhs.


Collation order is the dictionary order: the position of the letter in the national
alphabet (its equivalence class) has higher priority than its case or variant.
Within an equivalence class, lowercase characters collate before their uppercase
equivalents and locale-specific order may apply to the characters with diacritics.
In some locales, groups of characters compare as single collation units. For
example, "ch" in Czech follows "h" and precedes "i", and "dzs" in Hungarian follows
"dz" and precedes "g".

// Run this code


#include <iostream>
#include <cstring>
#include <clocale>


int main()
{
std::setlocale(LC_COLLATE, "cs_CZ.iso88592");


const char* s1 = "hrnec";
const char* s2 = "chrt";


std::cout << "In the Czech locale: ";
if(std::strcoll(s1, s2) < 0)
std::cout << s1 << " before " << s2 << '\n';
else
std::cout << s2 << " before " << s1 << '\n';


std::cout << "In lexicographical comparison: ";
if(std::strcmp(s1, s2) < 0)
std::cout << s1 << " before " << s2 << '\n';
else
std::cout << s2 << " before " << s1 << '\n';
}


In the Czech locale: hrnec before chrt
In lexicographical comparison: chrt before hrnec


wcscoll compares two wide strings in accordance to the current locale
(function)
do_compare compares two strings using this facet's collation rules
[virtual] (virtual protected member function of std::collate<CharT>)
transform a string so that strcmp would produce the same result as
strxfrm strcoll
(function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.