I want to remove a letter from a String - But only a single occurrence of the letter:
Example: if my word is "aaba" and I want to remove an 'a':
Output would be "aba" - Only the first 'a' is removed. (Not all the 'a's)
I came up with this:
String word = "aaba"
String newWord = word.replace(a, "");
The problem is that newWord='b' instead of 'aba'
Can someone please help? For some reason I am having much difficulty with this seemingly simple problem. What is the best way to solve this problem?
Do I need to create an ArrayList of some sort?