Created
February 15, 2019 11:49
-
-
Save vanloc0301/8c7b1f329962288858123f2fcf0f31f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public long removerSeparadoresDeValor(final BigDecimal bigDecimal) { | |
final DecimalFormat decimalFormat = (DecimalFormat)NumberFormat.getCurrencyInstance(new Locale("pt", "BR")); | |
decimalFormat.setMaximumFractionDigits(2); | |
final DecimalFormatSymbols decimalFormatSymbols = decimalFormat.getDecimalFormatSymbols(); | |
decimalFormatSymbols.setCurrencySymbol(""); | |
decimalFormat.setDecimalFormatSymbols(decimalFormatSymbols); | |
return Long.valueOf(decimalFormat.format(bigDecimal).replace(".", "").replace(",", "").trim()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment