org.pentaho.reporting.engine.classic.core.util
Class StringUtil

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.util.StringUtil

public final class StringUtil
extends Object

String utility functions. Provides functions to parse floats, ints and boolean values.

Author:
Thomas Morgner

Method Summary
static boolean parseBoolean(String attribute, boolean defaultValue)
          Parses the given string into a boolean value.
static float parseFloat(String value, float defaultValue)
          Parses the given string and returns the parsed integer value or the given default if the parsing failed.
static int parseInt(String value, int defaultValue)
          Parses the given string and returns the parsed integer value or the given default if the parsing failed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseInt

public static int parseInt(String value,
                           int defaultValue)
Parses the given string and returns the parsed integer value or the given default if the parsing failed.

Parameters:
value - the to be parsed string
defaultValue - the default value
Returns:
the parsed string.

parseFloat

public static float parseFloat(String value,
                               float defaultValue)
Parses the given string and returns the parsed integer value or the given default if the parsing failed.

Parameters:
value - the to be parsed string
defaultValue - the default value
Returns:
the parsed string.

parseBoolean

public static boolean parseBoolean(String attribute,
                                   boolean defaultValue)
Parses the given string into a boolean value. This returns true, if the string's value is "true".

Parameters:
attribute - the string that should be parsed.
defaultValue - the default value, in case the string is null.
Returns:
the parsed value.