Class ParsingUtils


  • public final class ParsingUtils
    extends java.lang.Object
    Utility to parse various inputs
    Since:
    1.10
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double parseNumber​(java.lang.String number)
      Parses a string with the default locale and returns the corresponding number
      static double parseNumber​(java.lang.String number, java.util.Locale locale)
      Parses a string with a locale and returns the corresponding number
      static double scaleValue​(double value)
      Scales a double value, taking into account 2 decimals
      static double scaleValue​(double value, int decimals)
      Scales a double value with decimals
      • Methods inherited from class java.lang.Object

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

      • parseNumber

        public static double parseNumber​(java.lang.String number,
                                         java.util.Locale locale)
                                  throws java.text.ParseException
        Parses a string with a locale and returns the corresponding number
        Throws:
        java.text.ParseException - if number cannot be parsed
      • parseNumber

        public static double parseNumber​(java.lang.String number)
                                  throws java.text.ParseException
        Parses a string with the default locale and returns the corresponding number
        Throws:
        java.text.ParseException - if number cannot be parsed
      • scaleValue

        public static double scaleValue​(double value)
        Scales a double value, taking into account 2 decimals
      • scaleValue

        public static double scaleValue​(double value,
                                        int decimals)
        Scales a double value with decimals