Ulong Find ( const Text &other, ulong position ) const

From FM Plugin Wikipedia
Jump to: navigation, search

Searches the current text looking for the 'search' text given.


Returns the position of the first character in the 'search' text, starting at the position given.

Returns fmx::Text::kSize_End = 0xFFFFFFFF if the 'search' text can't be found after the start position.



fmx::TextAutoPtr	  origText;
origText->Assign("This is my string to search for a word in");

fmx::TextAutoPtr	  searchText;
searchText->Assign("search");

ulong thePos = origText->Find(*searchText, 0 );    // will return  21 as the position of the 's' in 'search'  (assuming a zero based array)


Note : This is case sensitive, so while 'search' will return 21 in the above example, 'Search' will return kSize_End (not found). Use FindIgnoringCase if you don't want the case to be an issue.