How can we remove dollar sign ($) and all comma(,) from same string? Would it be better to avoid regex?
String liveprice = \"$123,456.78\";
import java.text.NumberFormat def currencyAmount = 9876543.21 //Default is BigDecimal def currencyFormatter = NumberFormat.getInstance( Locale.US ) assert currencyFormatter.format( currencyAmount ) == "9,876,543.21"
Don't need getCurrencyInstance() if currency is not required.
getCurrencyInstance()