/** * count the keyword in one line string. * * @param content * @return the count */ private int countLineKMP(String content) { int count = 0; if (content != null) { int index = kmp.indexOf(content, keyWord); while (index != -1) { count++; index = kmp.indexOf(content, keyWord, index + 6); } } return count; }