Tools.h++ Manual

104011 Tandem Computers Incorporated 5-3
5
RWCString s1, s2;
cin >> s1 >> s2;
cout << toUpper(s1+s2);
Class
RWCString
has member functions to read, compare, store, restore,
concatenate, prepend, and append
RWCStrings
and
char
*’s. Operators allow
access to individual characters, with or without bounds checking. The details
of the
RWCString
class capabilities are summarized in the Class Reference,
Part 2.
5.2 Collation
The various comparison operators involving
RWCString
use case sensitive
lexicographic comparisons:
RWBoolean operator==(const RWCString&, const RWCString&);
RWBoolean operator!=(const RWCString&, const RWCString&);
RWBoolean operator< (const RWCString&, const RWCString&);
RWBoolean operator<=(const RWCString&, const RWCString&);
RWBoolean operator> (const RWCString&, const RWCString&);
RWBoolean operator>=(const RWCString&, const RWCString&);
If you wish to make case insensitive comparisons, then you use should use
member function:
int RWCString::compareTo( const RWCString& str,
caseCompare cmp = exact)
const;
which returns an integer -1, 0, or 1, depending on whether
str
is
lexicographically less than, equal to, or greater than self, respectively. 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, use member function
int RWCString::collate(const RWCString& str) const;