vanted
Class Parser

java.lang.Object
  extended by vanted.Parser

public class Parser
extends java.lang.Object

The Class Parser tries to parse objects into int or double.

Author:
Kevin Pucknat

Constructor Summary
Parser()
           
 
Method Summary
static java.lang.Object parse(java.lang.String str)
          Try to parse the string to an int, if that dosen't work try to parse the string to a double, if that dosen't work return null.
static double parse2Double(java.lang.String str)
          Try to parse the string to a double, if that dosen't work return -1.
static java.lang.Object parse2Int(java.lang.String str)
          Try to parse the string to an int, if that dosen't work return the string.
static int parse2Int2(java.lang.String str)
          Try to parse the string to an int, if that dosen't work return -1.
static java.lang.Object parseAttr(java.lang.String str)
          Try to parse the string to an int, if that dosen't work try to parse the string to a double.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

parse

public static java.lang.Object parse(java.lang.String str)
Try to parse the string to an int, if that dosen't work try to parse the string to a double, if that dosen't work return null.

Parameters:
str - the str
Returns:
the object

parse2Int

public static java.lang.Object parse2Int(java.lang.String str)
Try to parse the string to an int, if that dosen't work return the string.

Parameters:
str - the str
Returns:
the object

parse2Int2

public static int parse2Int2(java.lang.String str)
Try to parse the string to an int, if that dosen't work return -1.

Parameters:
str - the str
Returns:
the int

parse2Double

public static double parse2Double(java.lang.String str)
Try to parse the string to a double, if that dosen't work return -1.

Parameters:
str - the str
Returns:
the double

parseAttr

public static java.lang.Object parseAttr(java.lang.String str)
Try to parse the string to an int, if that dosen't work try to parse the string to a double. If the double could be an int (e.g. 2.0) return an int, else return a double. Should the string not be an int or a double return null.

Parameters:
str - the str
Returns:
the object