質問

I have a value £211,064.10 and i want to convert like 211064.10 and i tried the following way

String value = "$107,990.67";       

String abc = value.replace(NumberFormat.getCurrencyInstance().getCurrency().getSymbol(), "");       
System.out.println(abc);
System.out.println(abc.replace(",", ""));`

But it works only for the currency symbol $ not for any other currency value.

役に立ちましたか?

解決

Using String.replaceAll:

String abc = value.replaceAll("[^0-9.]", "");
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top