I am trying to make a search function that finds a change in a text and then finds a string that matched the hint from a word bank and narrows down your searches.
Here is the one method that is causing the error and the line that it is putting I will make but I think it is just the general area.
public String[] wordSearchHint(String[] choices, int chars, String hint) {
if (choices.length > 0) {
String lasthint = "";
for (int i = 0; i < chars; i++) {
lasthint = lasthint + "_";
}
hint.replaceAll(" ", "_");
int loc = 0;
char letter = ' ';
boolean change = false;
boolean found = false;
String[] newchoices = new String[100];
for (int i = 0; i < hint.length(); i++) {
if (!(hint.charAt(i) == lasthint.charAt(i))) {
loc = i;
letter = hint.charAt(i);
change = true;
break;
}
}
if (change && choices.length > 0) {
for (int i = 0; i < choices.length; i++) {
if (!choices[i].isEmpty()) { //<<<<<<<<<<<<<<<<<<<<<<< <this is the exact line
if (choices[i].charAt(loc) == letter) {
newchoices[i] = choices[i];
found = true;
}
}
}
} else {
if (hint == lasthint) {
return choices;
}
}
if (found) {
return newchoices;
} else {
return choices;
}
} else {
return choices;
}
}