Little function that searches for a given string within another string. If the search string is found its position is returned, otherwise -1 is returned.
Code:
int find_text(String needle, String haystack){ int foundpos =-1; for(int i =0;(i < haystack.length()- needle.length()); i++){ if(haystack.substring(i,needle.length()+i)== needle){
foundpos = i; } } return foundpos; }