Android Number Format String2SymbolAmount(String str)

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

Description

String Symbol Amount

Declaration

public static String String2SymbolAmount(String str) 

Method Source Code

//package com.java2s;

import java.text.NumberFormat;

import java.util.Locale;

public class Main {

    public static String String2SymbolAmount(String str) {
        try {//from  w  w w  .j a  v a  2s .co  m
            String tempStr = NumberFormat.getNumberInstance()
                    .format(Long.parseLong(str, 10)).replace(",", "");
            double temp = Long.parseLong(tempStr) / 100.00;
            return NumberFormat.getCurrencyInstance(Locale.CHINA).format(
                    temp);
        } catch (Exception e) {
            e.printStackTrace();
            return str;
        }
    }
}