Package jmri.util

Class IntlUtilities


  • public class IntlUtilities
    extends java.lang.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
    • Constructor Summary

      Constructors 
      Constructor Description
      IntlUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double doubleValue​(java.lang.String val)
      Parse a number.
      static float floatValue​(java.lang.String val)
      Parse a number.
      static java.lang.String valueOf​(double val)
      Get the text representation of a number.
      static java.lang.String valueOf​(int val)
      Get the text representation of a number.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • floatValue

        public static float floatValue​(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().
        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​(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().
        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