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

From FM Plugin Wikipedia
Jump to: navigation, search

Searches the current text looking for the 'search' text given, working backwards from the passed start location.


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

Returns fmx::Text::kSize_End = 0xFFFFFFFF if the 'search' text can't be found before 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->FindPrevIgnoringCase(*searchText, origText->GetSize()  );    // will return  21 as the position of the 's' in 'search'  (assuming a zero based array)


Note : This is case insensitive, so both 'search' or 'Search' will return 21 in the above example. Use FindPrev if you want an exact match.