Package jmri.util

Class IntlUtilities

java.lang.Object
jmri.util.IntlUtilities

public class IntlUtilities extends Object
Common utility methods for Internationalization (I18N) and Localization (L12N) in the default Locale. See http://jmri.org/help/en/html/doc/Technical/I8N.shtml
Since:
3.9.3
  • Method Details

    • floatValue

      public static float floatValue(@Nonnull String val) throws 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:
      ParseException - if val cannot be parsed as a number
    • doubleValue

      public static double doubleValue(@Nonnull String val) throws 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:
      ParseException - if val cannot be parsed as a number
    • intValue

      public static int intValue(@Nonnull String val) throws 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:
      ParseException - if val cannot be parsed as a number
    • valueOf

      public static 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 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