/**
 * Combined
 */
public String formatDecimalNumber(final String decimalString) {
    try {
        String formattedString = decimalString.replaceFirst("^0+(?!$)", "");

        NumberFormat form = NumberFormat.getInstance();
        form.setMinimumIntegerDigits(1);

        return form.format(Float.parseFloat(formattedString));
    } catch (Exception e) {
        e.printStackTrace();
        return "";
    }
}

Comments

comments powered by Disqus
Copyright © 2013 Andro Chen
Powered by Logdown and Greyshade
Favicon from The Noun Project