Skip to content

Instantly share code, notes, and snippets.

View bkromhout's full-sized avatar

Brenden Kromhout bkromhout

  • Chapel Hill, NC
View GitHub Profile
@bkromhout
bkromhout / CurrencyUtils
Created June 8, 2013 15:16
Currency Utils: A class used on android to parse Locale-formatted currency strings to long values for the purpose of storing in a database, and parsing long currency values to locale-formatted strings. Note that this class does not care about exchange rates and does not attempt to do currency conversions.
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Currency;
import java.util.Locale;
/**