How can I remove duplicate substrings within a string? so for instance if I have a string like smith:rodgers:someone:smith:white then how can I get a new string that has the extra smith removed like smith:rodgers:someone:white. Also I’d like to keep the colons even though they are duplicated.
many thanks
Of course this code assumes that you’re only looking for duplicate “field” values. That won’t remove “smithsmith” in the following string:
It would be possible to write an algorithm to do that, but quite difficult to make it efficient…