Java Number Format Pattern strToFormatedNumber(String str)

Here you can find the source of strToFormatedNumber(String str)

Description

strToFormatedNumber

License

Open Source License

Parameter

Parameter Description
str a parameter

Return

String

Declaration

public static String strToFormatedNumber(String str) 

Method Source Code

//package com.java2s;

import java.text.NumberFormat;

public class Main {
    /**/*from www.j  a v a 2 s .co m*/
     * strToFormatedNumber
     * @param str
     * @return String
     */
    public static String strToFormatedNumber(String str) {
        long value = Long.parseLong(str);
        NumberFormat FORMAT = NumberFormat.getInstance();
        FORMAT.setGroupingUsed(true);
        return FORMAT.format(value);
    }
}

Related

  1. resetDecimalFormat()
  2. resetDecimalFormatByLocale(Locale locale)
  3. roundNumber(Number number, DecimalFormat format)
  4. stringFormat(BigDecimal value)
  5. stringToReais(String unformatted, boolean comSimbolo)
  6. toAccountantFormat(String str, int scale)
  7. toDecimalFormat(BigDecimal value)
  8. toFormattedNumber(Object value)
  9. toNumber(String numString, String numFormatPattern)