Search and Replace
RWUStringSearch supports search and replace functionality using the replace() method. This method searches a given RWUString for matches with the pattern stored in the RWUStringSearch object. Each match is replaced with a given replacement RWUString, up to a specified number of occurrences. The default number of occurrences to replace is 1. To replace all occurrences of the pattern, specify 0 occurrences. The method returns the number of occurrences actually replaced.
For example, this code replaces all occurrences of pattern in text2 with replacement:
 
RWUStringSearch searcher(pattern, text, collator);
RWUString replacement("UTF-16");
int32_t count = searcher.replace(text2, replacement, 0);
std::cout << "Replaced " << count << " occurrences." << std::endl;