NullPointer
in
Programming Questions
•
4 months ago
Hello
I am trying to make a code when where a person types something, pushes DELETE, it then looks for that word in a notepad document and if it finds it, it deletes it.
This is the main method
counter1 = 3;
fill(0);
texttest = loadStrings("words.txt");
addwords = loadStrings("addedwords.txt");
text("Type the word you want to remove, then push delete", 400, 100);
text(myText, 0, 0, width, height);
and this is what happens if you push delete and counter1=3
if (counter1 == 3){
for (int i = 0; i<texttest.length; i++){
if (texttest[i].equals(myText)){
texttest[i] = "";
}
}
for (int i = 0; i<addwords.length; i++){
if (addwords[i].equals(myText)){
addwords[i] = "";
}
}
saveStrings ("words.txt", texttest);
saveStrings ("addedwords.txt", addwords);
}
any help is appreciated
thanks
1