The below function worked with the WString library in IDE 0018. Is there an equivalant function in the string handling included in the 0021 IDE? The StringSubstring (bottom link) function does not seem to support the string search the old string.contains has.
The indexOf method is overloaded with char and String inputs for the thing to search for. It appears to be a replacement for contains. The indexOf method returns where in the string the substring occurs, or -1 if the substring does not exist.
Could be implemented somnething like this (naive search), not fast but straightforward. If in need for a faster check http://en.wikipedia.org/wiki/Boyer–Moore_string_search_algorithm
bool Contains( String s, String search)
int max = s.length() - search.length(); // the searchstring has to fit in the other one
for (int i=0; i<= max; i++)
if (s.substring(i) == search) return true; // or i
return false; //or -1
variation return the position i >= 0 if found , and -1 if not => functiontype should be int
update: Paul you beat me ! IndexOf is the way to go.
Good info. The below seems to do the job.