net.bonzoun.cocodonkey
Class StringParser

java.lang.Object
  extended bynet.bonzoun.cocodonkey.StringParser
Direct Known Subclasses:
SearchParser

public class StringParser
extends java.lang.Object


Field Summary
static java.lang.String FLOAT
           
static java.lang.String HEXA
           
static java.lang.String INTEGER
           
static java.lang.String WHITESPACE
           
 
Constructor Summary
StringParser(java.lang.String s)
           
 
Method Summary
 char getLastChar()
           
 float getLastFloat(int def)
           
 int getLastInt(int def)
           
 int getLastIntUntil(java.lang.String delim, int def)
           
 java.lang.String getLastString()
          Returns the last non empty chars
 java.lang.String getLastStringUntil(java.lang.String delim)
          Returns the last non empty chars until any char in delim is met, skipping the head withespaces
 char getNextChar()
           
 float getNextFloat(int def)
           
 int getNextInt(int def)
           
 int getNextIntUntil(java.lang.String delim, int def)
           
 java.lang.String getNextString()
          Returns the next non empty chars
 java.lang.String getNextStringUntil(java.lang.String delim)
          Returns the next non empty chars until any char in delim is met, skipping the head withespaces
 java.lang.String getRemainingString()
           
 boolean goAfter(char delim)
          Skips the next chars until delim is met
 boolean goBefore(char delim)
          Skips the next chars until delim is met
 boolean hasMoreData()
           
static float parseFloat(java.lang.String s, int def)
          Converts a String to an float, without failing
static int parseInt(java.lang.String s, int def)
          Converts a String to an int, without failing
static boolean stringContainsOnly(java.lang.String s, java.lang.String chars)
           
 char testLastChar()
           
 char testNextChar()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITESPACE

public static final java.lang.String WHITESPACE
See Also:
Constant Field Values

INTEGER

public static final java.lang.String INTEGER
See Also:
Constant Field Values

HEXA

public static final java.lang.String HEXA
See Also:
Constant Field Values

FLOAT

public static final java.lang.String FLOAT
See Also:
Constant Field Values
Constructor Detail

StringParser

public StringParser(java.lang.String s)
Method Detail

stringContainsOnly

public static boolean stringContainsOnly(java.lang.String s,
                                         java.lang.String chars)

hasMoreData

public boolean hasMoreData()

getNextString

public java.lang.String getNextString()
Returns the next non empty chars


getNextInt

public int getNextInt(int def)

getNextFloat

public float getNextFloat(int def)

getNextStringUntil

public java.lang.String getNextStringUntil(java.lang.String delim)
Returns the next non empty chars until any char in delim is met, skipping the head withespaces


getNextChar

public char getNextChar()

testNextChar

public char testNextChar()

getNextIntUntil

public int getNextIntUntil(java.lang.String delim,
                           int def)

goAfter

public boolean goAfter(char delim)
Skips the next chars until delim is met


goBefore

public boolean goBefore(char delim)
Skips the next chars until delim is met


getLastString

public java.lang.String getLastString()
Returns the last non empty chars


getLastInt

public int getLastInt(int def)

getLastFloat

public float getLastFloat(int def)

getLastStringUntil

public java.lang.String getLastStringUntil(java.lang.String delim)
Returns the last non empty chars until any char in delim is met, skipping the head withespaces


getLastChar

public char getLastChar()

testLastChar

public char testLastChar()

getLastIntUntil

public int getLastIntUntil(java.lang.String delim,
                           int def)

getRemainingString

public java.lang.String getRemainingString()

parseInt

public static int parseInt(java.lang.String s,
                           int def)
Converts a String to an int, without failing


parseFloat

public static float parseFloat(java.lang.String s,
                               int def)
Converts a String to an float, without failing