std::collate::compare, std::collate::do_compare
Defined in header <locale>
|
||
public:
int compare( const CharT* low1, const CharT* high1, |
(1) | |
protected:
int do_compare( const CharT* low1, const CharT* high1, |
(2) | |
1) public member function, calls the protected virtual member function do_compare
of the most derived class.
2) Compares the character sequence [low1, high1)
to the character sequence [low2, high2)
, using this locale's collation rules, and returns 1 if the first string follows the second, -1 if the first string precedes the second, zero if the two strings are equivalent.
Contents |
[edit] Parameters
low1 | - | pointer to the first character of the first string |
high1 | - | one past the end pointer for the first string |
low2 | - | pointer to the first character of the second string |
high2 | - | one past the end pointer for the second string |
[edit] Return value
1 if the first string is greater than the second (that is, follows the second in the collation order), -1 if the first string is less than the second (precedes the second in the collation order), zero if the two strings are equivalent.
[edit] Notes
Collation order is typically lexicographic case-insensitive comparison according to the locale's alphabet, but in some locales, groups of characters compare as single collation units. For example, "ch" in Czech follows "h" and precedes "i", and "ng" in Welsh follows "g" and precedes "h".
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
compares two strings in accordance to the current locale (function) |
|
compares two wide strings in accordance to the current locale (function) |
|
lexicographically compares two strings using this locale's collate facet (public member function of std::locale )
|