removeNchars
takes a String, an int and a char and returns a String: The output string is the same as the input string except that the first n occurrences of the input char are removed from the string, where n represents the input integer. If there are not n occurrences of the input character, then all occurrences of the character are removed. Do not use arrays
to solve this problem.
HW2.removeNchars("Hello there!", 2, 'e') "Hllo thre!"
HW2.removeNchars("Hello there!", 10, 'e') "Hllo thr!"
HW2.removeNchars("Hello there!", 1, 'h') "Hello tere!"
public class HW2{
public static String removeNchars(String s, int a, char b){
StringBuilder s = new StringBuilder();
for(int i = 0; i<s.length(); i++){
if(int i=a&& s.charAr(i)==b){
}
}
}
}