public final class NumberUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static Number |
NaN
Constant value representing "not a number".
|
| Modifier and Type | Method and Description |
|---|---|
static String |
autoIncrementVersion(String oldVersion)
Given an old version string, this attempts to auto-generate a new incremented version.
|
static String |
numberAsString(double input)
Format the
input number as a string (using the default locale). |
static String |
percentageAsString(double input)
Format the
input percentage as a string (using the default locale). |
static Number |
stringAsNumber(String input)
Parse the
input string (using the default locale) and return its numeric representation. |
static Number |
stringAsPercentage(String input)
Parse the
input string (using the default locale) and return its numeric percentage representation. |
public static final Number NaN
public static Number stringAsNumber(String input)
input string (using the default locale) and return its numeric representation. If the
input string is null, empty or cannot be parsed, return Double.NaN .public static String numberAsString(double input)
input number as a string (using the default locale). If the input number is
Double.NaN, return null.public static Number stringAsPercentage(String input)
input string (using the default locale) and return its numeric percentage representation.
If the input string is null, empty or cannot be parsed, return Double.NaN .public static String percentageAsString(double input)
input percentage as a string (using the default locale). If the input
percentage is Double.NaN, return null.Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.