public class RegexTokenizer extends Object implements Enumeration
Constructor and Description |
---|
RegexTokenizer(String txt,
Regex r)
Initialize the tokenizer with a Regex object.
|
RegexTokenizer(String txt,
String ptrn)
Initialize the tokenizer with a string of text and a pattern
|
Modifier and Type | Method and Description |
---|---|
String[] |
allTokens()
Returns all tokens in the String
|
int |
countTokens()
Determines the # of remaining tokens
|
boolean |
hasMoreElements()
Tells whether there are more tokens in the pattern.
|
boolean |
hasMoreTokens()
Tells whether there are more tokens in the pattern, but
in the fashion of StringTokenizer.
|
Object |
nextElement()
This should always be cast to a String, as in StringTokenizer,
and as in StringTokenizer one can do this by calling
nextString().
|
String |
nextToken()
This is the equivalent (String)nextElement().
|
String |
nextToken(Regex nr)
This asks for the next token, and changes the pattern
being used at the same time.
|
String |
nextToken(String newpat)
This asks for the next token, and changes the pattern
being used at the same time.
|
public RegexTokenizer(String txt, String ptrn)
public Object nextElement()
nextElement
in interface Enumeration
public String nextToken()
public String nextToken(String newpat)
public String nextToken(Regex nr)
public boolean hasMoreElements()
hasMoreElements
in interface Enumeration
public boolean hasMoreTokens()
public int countTokens()
public String[] allTokens()