Here you can find the source of getFormatter(String pattern)
Parameter | Description |
---|---|
pattern | the pattern string |
Parameter | Description |
---|---|
IllegalArgumentException | if the given pattern is invalid |
NullPointerException | if the given pattern is <code>null</code> |
public static DecimalFormat getFormatter(String pattern) throws IllegalArgumentException
//package com.java2s; /*/*from w w w .jav a2s . co m*/ * Copyright (c) 2016 wetransform GmbH * * All rights reserved. This program and the accompanying materials are made * available under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * wetransform GmbH <http://www.wetransform.to> */ import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; public class Main { /** * Create a {@link DecimalFormat} instance for the given pattern that uses * '.' as the decimal separator. * * @param pattern the pattern string * @return A {@link DecimalFormat} for the given pattern * @throws IllegalArgumentException if the given pattern is invalid * @throws NullPointerException if the given pattern is <code>null</code> * @see DecimalFormat */ public static DecimalFormat getFormatter(String pattern) throws IllegalArgumentException { DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator('.'); return new DecimalFormat(pattern, symbols); } }