RWUString performs comparisons on a lexical basis. Methods such as
compareTo(),
contains(),
first(),
last(),
index(),
rindex(),
strip(), and the global comparison operators compare the bit values of individual code units, not the logical values of code points or characters. In contrast,
RWUCollator performs comparisons on a logical basis, following the conventions specified in a given locale. The logical comparisons made by
RWUCollator are more likely to match an end user's expectations regarding string equality and ordering. The lexical comparisons made by
RWUString, however, are likely to be faster. If two strings contain characters from the same script, and are in the same normalization form, lexical comparisons may be adequate for many purposes. See
Chapter 6 for more information on
RWUCollator and locale-sensitive collation.