Java Number Format Pattern unformatAmount(String formattedNumber)

Here you can find the source of unformatAmount(String formattedNumber)

Description

unformats a formatted number to be a double again

License

Open Source License

Parameter

Parameter Description
string number to convert

Return

an unformatted number to be used for db interactions

Declaration

public static double unformatAmount(String formattedNumber) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.NumberFormat;
import java.text.ParseException;

public class Main {
    /**//  w  w  w .  ja  v a 2  s.  co m
     * unformats a formatted number to be a double again
     * 
     * @param string number to convert
     * @return an unformatted number to be used for db interactions
     */
    public static double unformatAmount(String formattedNumber) {
        NumberFormat numberFormatter = NumberFormat.getCurrencyInstance();
        Number number = null;
        try {
            number = numberFormatter.parse(formattedNumber);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        double unformattedNumber = number.doubleValue();
        return unformattedNumber;
    }
}

Related

  1. toFormattedNumber(Object value)
  2. toNumber(String numString, String numFormatPattern)
  3. toNumberFormat(String input)
  4. toString(int[] a, String separator, NumberFormat formatter)
  5. toStringFormatted(byte[] bytes)
  6. unformatingDecimalNumber(String cadena, Locale locale, int maxIntPart, int maxFloatPart)