TStandardTextPatternIterator also matches characters that are equivalent in Unicode. For example, à is equivalent to the sequence a and `.
The following example function shows how to search the contents of the text instance searchText
for the string in the text instance pattern. You must pass a text-ordering object to the TStandardTextPatternIterator constructor.
void FindString( TText& searchText, const TText& pattern ) { TTextRange foundRange; TTableBasedTextOrder *englishOrder = TTableBasedTextOrder( TToken("English") ); TStandardTextPatternIterator iterator( &searchText, pattern, TTextRange( 0, searchText.GetLength() ), &englishOrder ); if (iterator.First(foundRange) != TTextPatternIterator::kNotFoundOffset) { // Do something interesting... } else { // No pattern found. } }
TTableBasedTextOrder englishOrder = TTableBasedTextOrder( TToken("English") ); TTextPatternIterator *iterator = englishOrder.CreatePatternIterator( &searchText, pattern, TTextRange(0, searchText.GetLength()) );