I have this:
private String remove_spaces(String s){
s = s.trim();
String updated = "";
for (int i = 0; i < s.length(); i++) {
String tester = s.substring(i, i + 1);
String space = " ";
boolean isSpace = tester.equals(space);
if (isSpace = false)
updated += tester;
}
return updated;
}
And it throws an StringIndexOutOfBounds
, and I don't understand why. Why?