|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.dse.applsrv.aa.StringParser
This is an enhanced version of StringTokenizer.
Constructor Summary | |
StringParser(java.lang.String str)
Constructs a string parser for the specified string. |
|
StringParser(java.lang.String str,
java.lang.String delim)
Constructs a string parser for the specified string. |
|
StringParser(java.lang.String str,
java.lang.String delim,
boolean returnTokens)
Constructs a string tokenizer for the specified string. |
Method Summary | |
int |
countTokens()
Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception. |
boolean |
hasMoreElements()
Returns the same value as the hasMoreTokens method. |
boolean |
hasMoreTokens()
Tests if there are more tokens available from this tokenizer's string. |
boolean |
isDelimiter(char c)
Check if the specified character is a delimiter. |
java.lang.Object |
nextElement()
Returns the same value as the nextToken method, except that its declared return value is Object rather than String . |
java.lang.String |
nextToken()
Returns the next token from this string parser or nil if there are no more tokens. |
java.lang.String |
nextToken(java.lang.String delim)
Returns the next token in this string tokenizer's string. |
java.lang.String |
rest()
Returns the rest of the string. |
int[] |
restAsIntArray()
Returns the rest of the string as an integer array. |
java.lang.Integer[] |
restAsIntegerArray()
Returns the rest of the string as an integer array. |
java.lang.String[] |
restAsStringArray()
Returns the rest of the string as a string array. |
Array |
restAsStringArrays(java.lang.String delimiter)
Return the rest of the tokens as an array of string arrays delimited by the specified string. |
void |
rewind()
Rewind the parser. |
boolean |
selectToken(int n)
Set the read pointer before the n'th token (or EOF if the n'th token doesn't exist. |
void |
set(java.lang.String str)
Reset the parse for a new string. |
java.lang.String |
source()
Returns the original string. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public StringParser(java.lang.String str)
"\t\n\r"
: the space character, the tab character, the newline character, and the carriage-return character.str
- String - the string to be parsed.public StringParser(java.lang.String str, java.lang.String delim)
delim
argument are the delimiters for separating tokens.str
- String - a string to be parsed.delim
- String - the delimiters.public StringParser(java.lang.String str, java.lang.String delim, boolean returnTokens)
delim
argument are the delimiters for separating tokens.
If the returnTokens
flag is true
, then the delimiter characters are also returned as tokens.
Each delimiter is returned as a string of length one. If the flag is false
, the delimiter characters are skipped and only serve as separators between tokens.
str
- String - a string to be parsed.delim
- String - the delimiters.returnTokens
- boolean - flag indicating whether to return the delimiters as tokens.Method Detail |
public int countTokens()
nextToken
method can be called before it generates an exception.public boolean hasMoreElements()
hasMoreTokens
method. It exists so that this class can implement the Enumeration
interface.true
if there are more tokens, false
otherwise.public boolean hasMoreTokens()
true
if there are more tokens available from this tokenizer's string, false
otherwise.public boolean isDelimiter(char c)
c
- char - the character to check.public java.lang.Object nextElement()
nextToken
method, except that its declared return value is Object
rather than String
.
It exists so that this class can implement the Enumeration
interface.public java.lang.String nextToken()
public java.lang.String nextToken(java.lang.String delim)
delim
- String - the new delimiters.public java.lang.String rest()
public int[] restAsIntArray()
public java.lang.Integer[] restAsIntegerArray()
public java.lang.String[] restAsStringArray()
public Array restAsStringArrays(java.lang.String delimiter)
delimiter
- String - the delimiter.public void rewind()
public boolean selectToken(int n)
n
- int - the token to select (counting from 1).public void set(java.lang.String str)
"\t\n\r"
: the space character, the tab character, the newline character, and the carriage-return character.str
- String - the string to be parsed.public java.lang.String source()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |