So I need to remove duplicates of a specific string from another string in Java, a few examples:
'test12312312312' -> Remove duplicates of '123', output -> 'test12312'
'my sentence-!!!!!!!!!' -> Remove duplicates of '!!' , output -> 'my sentence-!!!'
'3rd ?!?!?!abd%3!?!?!??'-> Remove duplicates of '!?' , output -> '3rd ?!?!abd%3?'
Hopefully those examples make this clear. e.g. you pass a function any two strings, and it removes all duplicates of the first one from the second. For example it might look like:
String removeDuplicates(String checkString, String message) {
//Return 'message' with duplicates of 'checkString' removed
}
I've seen various implementations of this for removing all instances of the string, or removing duplicates of a specific character - but none that keep the first occurance of a string. Any ideas?