net.twonky
Class StringConvert

java.lang.Object
  extended by net.twonky.StringConvert

public class StringConvert
extends Object


Constructor Summary
StringConvert()
           
 
Method Summary
static Double toDouble(String string)
          Converts the given string to a double.
static Double toDouble(String string, Double defaultValue)
          Converts the given string to a double.
static Integer toInteger(String string)
          Converts the given string to an integer.
static Integer toInteger(String string, Integer defaultValue)
          Converts the given string to an integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringConvert

public StringConvert()
Method Detail

toInteger

public static Integer toInteger(String string,
                                Integer defaultValue)
Converts the given string to an integer.

Parameters:
string - the sting to convert.
defaultValue - a default value to use if string does not represent a valid integer.
Returns:
integer value of string or defaultValue if string does not represent a valid integer.

toInteger

public static Integer toInteger(String string)
Converts the given string to an integer.

Parameters:
string - the string to convert.
Returns:
integer value of string or null if string does not represent a valid integer.

toDouble

public static Double toDouble(String string,
                              Double defaultValue)
Converts the given string to a double.

Parameters:
string - the string to convert.
defaultValue - a default value to use if string does not represent a valid double.
Returns:
double value of string or defaultValue if string does not represent a valid double.

toDouble

public static Double toDouble(String string)
Converts the given string to a double.

Parameters:
string - the string to convert.
Returns:
double value of string or null if string does not represent a valid double.


Copyright © 2012. All Rights Reserved.