I would like to share my code with you to help me improve.
I need to write a function that returns a String
consisting of string1
minus all the characters of string2
.
Here is what I tried, unfortunately it doesn't work that well:
public static String remove(String str1, String str2) {
String empty = "";
for (int i = 0; i < str2.length(); i++) { // hello ll
for (int j = 0; j < str1.length(); j++) {
if (str2.charAt(i) != str1.charAt(j)) {
empty = empty + str1.charAt(j);
}
}
}
return empty;
}