Merge pull request #5601 from varunu28/master
Fixed a bug in findWord method
This commit is contained in:
commit
ab821cb4e5
|
@ -11,11 +11,14 @@ public class WordIndexer {
|
||||||
String lowerCaseTextString = textString.toLowerCase();
|
String lowerCaseTextString = textString.toLowerCase();
|
||||||
String lowerCaseWord = word.toLowerCase();
|
String lowerCaseWord = word.toLowerCase();
|
||||||
|
|
||||||
while(index != -1){
|
while(index != -1) {
|
||||||
index = lowerCaseTextString.indexOf(lowerCaseWord, index + 1);
|
index = lowerCaseTextString.indexOf(lowerCaseWord, index);
|
||||||
if (index != -1) {
|
if (index == -1) {
|
||||||
indexes.add(index);
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
indexes.add(index);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
return indexes;
|
return indexes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue