Lexicographic Comparisons
If you are putting together a dictionary, you will find the lexicographics comparison operators of RWCString particularly useful. They are:
 
bool operator==(const RWCString&, const RWCString&);
bool operator!=(const RWCString&, const RWCString&);
bool operator< (const RWCString&, const RWCString&);
bool operator<=(const RWCString&, const RWCString&);
bool operator> (const RWCString&, const RWCString&);
bool operator>=(const RWCString&, const RWCString&);
These operators are case sensitive. If you wish to make case insensitive comparisons, you can use the member function:
 
int RWCString::compareTo(const RWCString& str,
caseCompare = RWCString::exact) const;
Here the function returns an integer less than zero, equal to zero, or greater than zero, depending on whether str is lexicographically less than, equal to, or greater than self. The type caseCompare is an enum with values:
exact
Case sensitive
ignoreCase
Case insensitive
Its default setting is exact, which gives the same result as the logical operators ==, !=, etc.
For locale-specific string collations, you would use the member function:
 
int RWCString::collate(const RWCString& str) const;
which is an encapsulation of the Standard C library function strcoll(). This function returns results computed according to the locale-specific collating conventions set by category LC_COLLATE of the Standard C library function setlocale(). Because this is a relatively expensive calculation, you may want to pretransform one or more strings using the global function:
 
RWCString strXForm(const RWCString&);
then use compareTo() or one of the logical operators, ==, !=, etc., on the results. See the SourcePro API Reference Guide entry for RWCString: the function strXForm() appears under related functions.