Modifying Code Points with Iterators
Code points in an RWUString can be changed using an RWUStringIterator. For example, consider an RWUStringIterator it, and a code point stored in an RWUChar32 named cp. The statement changes the code point referenced by it to the value in cp:
 
*it = cp;
Note that this operation may change the code unit length of the original RWUString if a surrogate pair is replaced with a code point represented by a single code unit, or vice-versa.
The following code replaces all carriage return characters in an RWUString str with NULL characters:
 
for (RWUStringIterator it = str.beginCodePointIterator();
it != str.endCodePointIterator();
++it) {
if (RWUChar32(0x000d) == *it) *it = RWUChar32(0x0000);
}
Code points in an RWUString cannot be changed using an RWUConstStringIterator. This class provides read-only access to an RWUString.