Java Number Format Pattern getNumberFormat(final String pattern)

Here you can find the source of getNumberFormat(final String pattern)

Description

get Number Format

License

Open Source License

Parameter

Parameter Description
pattern the DecimalFormat pattern.

Return

The default of the pattern with .

Declaration

public static NumberFormat getNumberFormat(final String pattern) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2014, 2015 QPark Consulting  S.a r.l.
 * //from  w ww .java  2  s .c  o  m
 * This program and the accompanying materials are made available under the 
 * terms of the Eclipse Public License v1.0. 
 * The Eclipse Public License is available at 
 * http://www.eclipse.org/legal/epl-v10.html.
 ******************************************************************************/

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.Locale;

public class Main {
    /**
     * @param pattern
     *            the {@link DecimalFormat} pattern.
     * @return The default {@link DecimalFormat} of the pattern with
     *         {@link Locale#ENGLISH}.
     */
    public static NumberFormat getNumberFormat(final String pattern) {
        DecimalFormat df = new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(Locale.ENGLISH));
        return df;
    }
}

Related

  1. getNumberComma(String number)
  2. getNumberFormat()
  3. getNumberFormat()
  4. getNumberFormat(BigDecimal num, final int digits)
  5. getNumberFormat(double d)
  6. getNumberFormat(int maximumFractionDigits)
  7. getNumberFormat(String format, Locale locale)
  8. getNumberFormat(String localeStr)
  9. getNumberFormatFromCache(Locale locale, Currency currency)