|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.moremotion.util.StringParserEx
public class StringParserEx
String Parser parses the items in a string bwith the specified delimiter. The difference of this class from the java.util.StringTokenizer is that this class ignores the delimiters enclosed with (), [], {} , '', "" characters.
Example:
StringParser sp = new StringParser("(xxx,yyy)',',[(qqq,www),(ppp,rrr)],zzz",','); sp.nextItem(); // returns "(xxx,yyy)','" sp.nextItem(); // returns "[(qqq,www),(ppp,rrr)] sp.nextItem(); // returns "zzz"
Constructor Summary | |
---|---|
StringParserEx(java.lang.String str,
java.lang.String[] dlms,
char[] oencls,
char[] cencls)
Creates a new StringParser |
Method Summary | |
---|---|
java.lang.String |
firstItem()
Returns the first item in the string. |
java.lang.String |
getDelimiter()
|
boolean |
hasMore()
Returns true if end of string is reached. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
nextEnclosed()
|
java.lang.String |
nextItem()
Returns the next item in the string. |
boolean |
nextItemAsBoolean()
Returns the next item as boolean . |
int |
nextItemAsInt(int defValue)
Returns the next item as int and if next item is not a number it returns the default value. |
void |
reset()
Moves the cursor to the first position. |
void |
trimmed()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringParserEx(java.lang.String str, java.lang.String[] dlms, char[] oencls, char[] cencls)
Method Detail |
---|
public boolean hasMore()
true
if end of string is reached.
public void trimmed()
public java.lang.String firstItem()
public java.lang.String nextItem()
public void reset()
public java.lang.String getDelimiter()
public int nextItemAsInt(int defValue)
int
and if next item is not a number it returns the default value.
public boolean nextItemAsBoolean()
boolean
. If the next item is not "true" returns false
.
public java.lang.String nextEnclosed()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |