public class NumberUtil
extends java.lang.Object
Constructor and Description |
---|
NumberUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
format(double number,
java.lang.String format)
Return the parameter number formatted according to the parameter
FormatString . |
static java.lang.String |
format(java.lang.Double number,
java.lang.String format)
Return the parameter number formatted according to the parameter
FormatString . |
static java.lang.String |
format(float number,
java.lang.String format)
Return the parameter number formatted according to the parameter
FormatString . |
static java.lang.String |
format(java.lang.Float number,
java.lang.String format)
Return the parameter number formatted according to the parameter
FormatString . |
static java.lang.String |
format(java.lang.Integer number,
java.lang.String format)
Return the parameter number formatted according to the parameter
FormatString . |
static java.lang.String |
format(int number,
java.lang.String format)
Return the parameter number formatted according to the parameter
FormatString . |
static java.lang.String |
getCurrencySymbol()
The currency symbol to use when formatting numbers
|
static java.lang.String |
getDecimalSymbol()
The decimal symbol to use when formatting numbers
|
static int |
getGroupingFormat()
The grouping-format for numbers
|
static java.lang.String |
getGroupingSymbol()
The grouping symbol, or thousands separator, to use when formatting numbers
|
static int |
getNegativeFormat()
The format to use when formatting nagative numbers.
|
static java.lang.String |
getNegativeSymbol()
The negative symbol to use when formatting numbers
|
static java.lang.Boolean |
isBetween(int number)
Returns true if the number parameter falls between the 'first' and 'second' parameters.
|
static java.lang.Boolean |
isBetween(int number,
int first) |
static java.lang.Boolean |
isBetween(int number,
int first,
int second) |
static java.lang.Boolean |
isBetween(int number,
int first,
int second,
int inclusive)
Returns true if the number parameter falls between the 'first' and 'second' parameters.
|
static void |
setCurrencySymbol(java.lang.String currencySymbol)
The currency symbol to use when formatting numbers
|
static void |
setDecimalSymbol(java.lang.String decimalSymbol)
The decimal symbol to use when formatting numbers
|
static void |
setGroupingFormat(int groupingFormat)
The grouping-format for numbers
|
static void |
setGroupingSymbol(java.lang.String groupingSymbol)
The grouping symbol, or thousands separator, to use when formatting numbers
|
static void |
setNegativeFormat(int negativeFormat)
The format to use when formatting nagative numbers.
|
static void |
setNegativeSymbol(java.lang.String negativeSymbol)
The negative symbol to use when formatting numbers
|
public static void setCurrencySymbol(java.lang.String currencySymbol)
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
currencySymbol
- new currencySymbol. Default value is "$".public static java.lang.String getCurrencySymbol()
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
public static void setDecimalSymbol(java.lang.String decimalSymbol)
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
decimalSymbol
- new decimalSymbol. Default value is ".".public static java.lang.String getDecimalSymbol()
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
public static void setGroupingFormat(int groupingFormat)
Note: the correct format is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
groupingFormat
- new groupingFormat. Default value is 1.public static int getGroupingFormat()
Note: the correct format is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
public static void setGroupingSymbol(java.lang.String groupingSymbol)
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
groupingSymbol
- new groupingSymbol. Default value is ",".public static java.lang.String getGroupingSymbol()
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
public static void setNegativeFormat(int negativeFormat)
Note: the correct format is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
negativeFormat
- new negativeFormat. Default value is 1.public static int getNegativeFormat()
Note: the correct format is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
public static void setNegativeSymbol(java.lang.String negativeSymbol)
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
negativeSymbol
- new negativeSymbol. Default value is "-".public static java.lang.String getNegativeSymbol()
Note: the correct symbol is normally auto-derived from GWT's locale system, so the only valid reason to set it is desiring to use a language from one locale in combination with formatting rules from another locale, in a single application and for a single end user.
public static java.lang.Boolean isBetween(int number)
number
- Number object to be evaluatednumber
falls inside the given range, false otherwise @example n = 3; bool =
n.isBetween(3, 3, 6, true); // truepublic static java.lang.Boolean isBetween(int number, int first)
isBetween(int)
public static java.lang.Boolean isBetween(int number, int first, int second)
isBetween(int)
public static java.lang.Boolean isBetween(int number, int first, int second, int inclusive)
number
- Number object to be evaluatedfirst
- Number at the lower boundarysecond
- Number at the upper boundaryinclusive
- Whether or not the numbers at either end of the boundary should be included in the comparisonnumber
falls inside the given range, false otherwise @example n = 3; bool =
n.isBetween(3, 3, 6, true); // truepublic static java.lang.String format(int number, java.lang.String format)
FormatString
. This
method is used to implement the format
functionality, but it
can also be used to format arbitrary numbers programmatically.number
- The number to formatformat
- The format to apply. See FormatString
public static java.lang.String format(float number, java.lang.String format)
FormatString
. This
method is used to implement the format
functionality, but it
can also be used to format arbitrary numbers programmatically.number
- The number to formatformat
- The format to apply. See FormatString
public static java.lang.String format(double number, java.lang.String format)
FormatString
. This
method is used to implement the format
functionality, but it
can also be used to format arbitrary numbers programmatically.number
- The number to formatformat
- The format to apply. See FormatString
public static java.lang.String format(java.lang.Integer number, java.lang.String format)
FormatString
. This
method is used to implement the format
functionality, but it
can also be used to format arbitrary numbers programmatically.number
- The number to formatformat
- The format to apply. See FormatString
public static java.lang.String format(java.lang.Float number, java.lang.String format)
FormatString
. This
method is used to implement the format
functionality, but it
can also be used to format arbitrary numbers programmatically.number
- The number to formatformat
- The format to apply. See FormatString
public static java.lang.String format(java.lang.Double number, java.lang.String format)
FormatString
. This
method is used to implement the format
functionality, but it
can also be used to format arbitrary numbers programmatically.number
- The number to formatformat
- The format to apply. See FormatString