Java - Character replacement in a string
<p>I'm having some troubles the replacement of a character in a string. The code works perfectly fine for the removal of hyphens an periods, however for the letter 'e' it removes the 'e' in "test", and it also converts the three 'e's at the end of the string. Does anyone know why this is happening?</p>

<pre><code>        String str = "This is a test string, 12345! -12e3.0 eee";
    for(int i = 0; i &lt; str.length(); i++) {
        if((str.charAt(i) == '-') &amp;&amp; (Character.isDigit(str.charAt(i+1)))) {
            str = str.replace(str.charAt(i), '*');
        }

        if((str.charAt(i) == 'e') &amp;&amp; (Character.isDigit(str.charAt(i+1)))) {
            str = str.replace(str.charAt(i), '*');
        }

        if((str.charAt(i) == '.') &amp;&amp; (Character.isDigit(str.charAt(i+1)))) {
            str = str.replace(str.charAt(i), '*');
        }
    }
    str = str.replaceAll("[1234567890]", "*");
    System.out.println(str);
</code></pre>
