| java.lang.Object java.util.StringTokenizer
StringTokenizer | public class StringTokenizer implements Enumeration<Object>(Code) | | String tokenizer is used to break a string apart into tokens.
If returnDelimiters is false, successive calls to nextToken() return maximal
blocks of characters that do not contain a delimiter.
If returnDelimiters is true, delimiters are considered to be tokens, and
successive calls to nextToken() return either a one character delimiter, or a
maximal block of text between delimiters.
|
Constructor Summary | |
public | StringTokenizer(String string) Constructs a new StringTokenizer for string using whitespace as the
delimiter, returnDelimiters is false. | public | StringTokenizer(String string, String delimiters) Constructs a new StringTokenizer for string using the specified
delimiters, returnDelimiters is false. | public | StringTokenizer(String string, String delimiters, boolean returnDelimiters) Constructs a new StringTokenizer for string using the specified
delimiters and returning delimiters as tokens when specified. |
Method Summary | |
public int | countTokens() Returns the number of unprocessed tokens remaining in the string. | public boolean | hasMoreElements() Returns true if unprocessed tokens remain. | public boolean | hasMoreTokens() Returns true if unprocessed tokens remain. | public Object | nextElement() Returns the next token in the string as an Object. | public String | nextToken() Returns the next token in the string as a String. | public String | nextToken(String delims) Returns the next token in the string as a String. |
StringTokenizer | public StringTokenizer(String string)(Code) | | Constructs a new StringTokenizer for string using whitespace as the
delimiter, returnDelimiters is false.
Parameters: string - the string to be tokenized |
StringTokenizer | public StringTokenizer(String string, String delimiters)(Code) | | Constructs a new StringTokenizer for string using the specified
delimiters, returnDelimiters is false.
Parameters: string - the string to be tokenized Parameters: delimiters - the delimiters to use |
StringTokenizer | public StringTokenizer(String string, String delimiters, boolean returnDelimiters)(Code) | | Constructs a new StringTokenizer for string using the specified
delimiters and returning delimiters as tokens when specified.
Parameters: string - the string to be tokenized Parameters: delimiters - the delimiters to use Parameters: returnDelimiters - true to return each delimiter as a token |
countTokens | public int countTokens()(Code) | | Returns the number of unprocessed tokens remaining in the string.
number of tokens that can be retreived before an exception willresult |
hasMoreElements | public boolean hasMoreElements()(Code) | | Returns true if unprocessed tokens remain.
true if unprocessed tokens remain |
hasMoreTokens | public boolean hasMoreTokens()(Code) | | Returns true if unprocessed tokens remain.
true if unprocessed tokens remain |
nextElement | public Object nextElement()(Code) | | Returns the next token in the string as an Object.
next token in the string as an Object exception: NoSuchElementException - if no tokens remain |
nextToken | public String nextToken()(Code) | | Returns the next token in the string as a String.
next token in the string as a String exception: NoSuchElementException - if no tokens remain |
nextToken | public String nextToken(String delims)(Code) | | Returns the next token in the string as a String. The delimiters used are
changed to the specified delimiters.
Parameters: delims - the new delimiters to use next token in the string as a String exception: NoSuchElementException - if no tokens remain |
|
|