Package org.sonar.api.utils
Class ParsingUtils
- java.lang.Object
-
- org.sonar.api.utils.ParsingUtils
-
public final class ParsingUtils extends java.lang.ObjectUtility to parse various inputs- Since:
- 1.10
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleparseNumber(java.lang.String number)Parses a string with the default locale and returns the corresponding numberstatic doubleparseNumber(java.lang.String number, java.util.Locale locale)Parses a string with a locale and returns the corresponding numberstatic doublescaleValue(double value)Scales a double value, taking into account 2 decimalsstatic doublescaleValue(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.ParseExceptionParses 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.ParseExceptionParses 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
-
-