I need to find repeated words on a string, and then count how many times they were repeated. So basically, if the input string is this:
String s = \"House, House
Hope this helps :
public static int countOfStringInAText(String stringToBeSearched, String masterString){ int count = 0; while (masterString.indexOf(stringToBeSearched)>=0){ count = count + 1; masterString = masterString.substring(masterString.indexOf(stringToBeSearched)+1); } return count; }