Package jmri.util
Class IntlUtilities
- java.lang.Object
-
- jmri.util.IntlUtilities
-
public class IntlUtilities extends java.lang.Object
Common utility methods for Internationalization (I18N) and Localization (L12N) in the defaultLocale. See http://jmri.org/help/en/html/doc/Technical/I8N.shtml- Since:
- 3.9.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubledoubleValue(java.lang.String val)Parse a number.static floatfloatValue(java.lang.String val)Parse a number.static intintValue(java.lang.String val)Parse a number.static java.lang.StringvalueOf(double val)Get the text representation of a number.static java.lang.StringvalueOf(int val)Get the text representation of a number.
-
-
-
Method Detail
-
floatValue
public static float floatValue(@Nonnull java.lang.String val) throws java.text.ParseException
Parse a number. Use as a locale-aware replacement for Float.valueOf("1").floatValue() and Float.parseFloat("1").floatValue().White space, potentially included as a thousand separator is removed.
- Parameters:
val- the value to parse- Returns:
- a parsed number
- Throws:
java.text.ParseException- if val cannot be parsed as a number
-
doubleValue
public static double doubleValue(@Nonnull java.lang.String val) throws java.text.ParseException
Parse a number. Use as a locale-aware replacement for Double.valueOf("1").doubleValue() and Double.parseDouble("1").doubleValue().White space, potentially included as a thousand separator is removed.
- Parameters:
val- the value to parse- Returns:
- a parsed number
- Throws:
java.text.ParseException- if val cannot be parsed as a number
-
intValue
public static int intValue(@Nonnull java.lang.String val) throws java.text.ParseException
Parse a number. Use as a locale-aware replacement for Integer.valueOf("1").intValue() and Integer.parseInt("1").intValue().White space, potentially included as a thousand separator is removed.
- Parameters:
val- the value to parse- Returns:
- a parsed number
- Throws:
java.text.ParseException- if val cannot be parsed as a number
-
valueOf
public static java.lang.String valueOf(double val)
Get the text representation of a number. Use as a locale-aware replacement for String.valueOf(2.3).- Parameters:
val- the number- Returns:
- the text representation
-
valueOf
public static java.lang.String valueOf(int val)
Get the text representation of a number. Use as a locale-aware replacement for String.valueOf(5).- Parameters:
val- the number- Returns:
- the text representation
-
-