문제

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