public final class NumberFormater extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
asSubscriptNumber(String numStr)
Replaces all digit characters and the minus-sing with the corresponding
Unicode subscript symbols.
|
static String |
asSuperscriptNumber(String numStr)
Replaces all digit characters and the minus-sing with the corresponding
Unicode superscript symbols.
|
protected static String |
formatNumberDefault(double convertedValue,
int sigFig)
Formats the given value like Wikipedia does on default.
|
static String |
formatNumberRounded(double convertedValue,
int digitsAfterFloatingPoint)
Rounds and formats a value to the given count of digits after the
floating point.
|
static String |
formatRegular(BigDecimal number) |
static String |
formatRegular(double number) |
static String |
formatScientific(double number) |
protected static boolean |
isNumberValid(String numberStr)
Checks if the given number string is probably a valid value.
|
protected static double |
parseNumber(String numberStr)
Tries to parse a number-string into a valid double value.
|
public static String formatScientific(double number)
public static String formatRegular(double number)
public static String formatRegular(BigDecimal number)
public static String formatNumberRounded(double convertedValue, int digitsAfterFloatingPoint)
convertedValue - The value to format.digitsAfterFloatingPoint - Digits behind the floating point [0..16].protected static String formatNumberDefault(double convertedValue, int sigFig)
convertedValue - The value to format.sigFig - The count of significant figures to round.protected static boolean isNumberValid(String numberStr)
parseNumber() fail anyway.numberStr - The number as string to check.parseNumber()protected static double parseNumber(String numberStr) throws NumberFormatException
numberStr - The number as string to convert.NumberFormatExceptionhttps://en.wikipedia.org/wiki/Template:Convert/doc#Numberspublic static String asSuperscriptNumber(String numStr)
numStr - The String containing the numbers.Copyright © 2010–2018 University of Erlangen-Nürnberg - Open Source Research Group. All rights reserved.