org.sonar.api.utils
Class ParsingUtils

java.lang.Object
  extended by org.sonar.api.utils.ParsingUtils

public final class ParsingUtils
extends Object

Utility to parse various inputs

Since:
1.10

Method Summary
static double parseNumber(String number)
          Parses a string with the default locale and returns the corresponding number
static double parseNumber(String number, 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(String number,
                                 Locale locale)
                          throws ParseException
Parses a string with a locale and returns the corresponding number

Throws:
ParseException - if number cannot be parsed

parseNumber

public static double parseNumber(String number)
                          throws ParseException
Parses a string with the default locale and returns the corresponding number

Throws:
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



Copyright © 2009-2013 SonarSource. All Rights Reserved.