How to remove duplicates of a string from another string in Java?
<p>So I need to remove duplicates of a specific string from another string in Java, a few examples:</p>

<pre><code>'test12312312312'       -&gt; Remove duplicates of '123', output -&gt; 'test12312'
'my sentence-!!!!!!!!!' -&gt; Remove duplicates of '!!' , output -&gt; 'my sentence-!!!'
'3rd ?!?!?!abd%3!?!?!??'-&gt; Remove duplicates of '!?' , output -&gt; '3rd ?!?!abd%3?'
</code></pre>

<p>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:</p>

<pre><code>String removeDuplicates(String checkString, String message) {
    //Return 'message' with duplicates of 'checkString' removed
}
</code></pre>

<p>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?</p>