I have a "balance" string which contain a dollar sign in front of it. I would like to amend this sign, so I can convert the sting to double, but my code isn't working.
Here is what I've tried:
String balance = "$5.30";
balance = balance.replaceFirst("$", "");
It looks like the code doesn't make any difference. To make it even more weird, the code below does exactly what I need:
String balance = "$5.30";
balance = balance.replaceFirst(".", "");
Even though I could of just use the 2nd code, I want to understand why does it lead to this result.