Package org.sonar.api.utils
Class ParsingUtils
- java.lang.Object
-
- org.sonar.api.utils.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 numberstatic double
parseNumber(java.lang.String number, java.util.Locale locale)
Parses a string with a locale and returns the corresponding numberstatic double
scaleValue(double value)
Scales a double value, taking into account 2 decimalsstatic double
scaleValue(double value, int decimals)
Scales a double value with decimals
-
-
-
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
-
-