| Constructor and Description |
|---|
SymbolTokenizer(String[] symbols,
String[] preDelimiters,
String[] postDelimiters)
Create a new symbol tokenizer using the specified symbols and any valid
delimiters.
|
SymbolTokenizer(String string,
String[] symbols,
String[] preDelimiters,
String[] postDelimiters)
Create a new symbol tokenizer using the specified symbols and any valid
delimiters and ready to tokenize the given string.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Determines whether there are more tokens, symbols or otherwise,
remaining to be parsed in the string.
|
String |
next()
Get the next token, symbol or otherwise.
|
int |
position()
Get the current parse position.
|
void |
remove() |
void |
reset()
Resets the tokenizer to the parse from the beginning of the current
string.
|
void |
setString(String string)
Apply a new string to be parsed by this tokenizer and reset the
tokenizer.
|
String |
string()
Get the string being parsed.
|
boolean |
wasSymbol()
Indicates whether the last token returned via next() was a special
symbol or not.
|
public SymbolTokenizer(String[] symbols, String[] preDelimiters, String[] postDelimiters)
symbols - array of recognized symbol stringspreDelimiters - string of characters that may precede each
respective symbol; elements may be null if symbol has no special
constraintpostDelimiters - string of characters that may follow each
respective symbol; elements may be null if symbol has no special
constraintpublic SymbolTokenizer(String string, String[] symbols, String[] preDelimiters, String[] postDelimiters)
string - string to be parsedsymbols - array of recognized symbol stringspreDelimiters - string of characters that may precede each
respective symbol; elements may be null if symbol has no special
constraintpostDelimiters - string of characters that may follow each
respective symbol; elements may be null if symbol has no special
constraintpublic String string()
public void setString(String string)
string - string to be parsedpublic int position()
public void reset()
public boolean hasNext()
public String next()
public boolean wasSymbol()
Copyright © 2014. All Rights Reserved.