### Character Data

IText provides several functions for accessing specific characters or character ranges.

The framework provides a special class, ICharacterReference, that acts as a simple proxy class to access single `UniChar` values. IText uses ICharacterReference wherever a non-`const` reference to a `UniChar` is required. ICharacterReference provides a safer character reference mechanism by:

- Filtering out-of-range character references that might cause memory problems
- Protecting the integrity of an IText object's underlying storage mechanism, which might be shared
- Protecting against style propagation problems

ICharacterReference provides an operator that returns a copy of the referenced `UniChar` values.

This figure shows the low-level IText functions for accessing characters:

- operator[] and at return a reference to or copy of the character at a specified offset.
- at_put lets you set the character at a particular offset to a specified character. The ICharacterReference assignment operator also supports this.
- substr provides an IText object containing a copy of a specified range of characters.

#### Editing Character Data

IText provides functions for editing character data. You can specify the text to add to the object as:

- Another IText object
- A `UniChar` array (null-terminated or with a specified length)
- A range of an IText defined by a pair of iterators
- A range of an IText defined by an offset and a character count

Unless noted, text added to an IText retains its character styling information (Unicode characters inserted into an IText are considered unstyled). Paragraph styles are propagated as appropriate.

This figure shows the IText interfaces for editing character data:

- operator+= and append add a string to the end of the current text.
- insert inserts a string at a specified offset (you specify the offset of the character after which new text is to be inserted).
- insert_and_propagate_styles inserts a string at a specified offset. The inserted string takes on the styles of the surrounding text.
- erase deletes the characters in a specified range.
- replace replaces a range of characters with another string.

Unlike IString::change, the IText::replace function is not able to perform a full search and replace.