StringTokenizer class methods in Java

java.util.StringTokenizer

The string tokenizer class allows an application to break a string into tokens. The StringTokenizer methods do not distinguish among identifiers, numbers, and quoted strings, nor do they recognize and skip comments.


Some methods of StringTokenizer  class


countTokens(): This method calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.


hasMoreElements(): This method returns true if more tokens are available.


hasMoreTokens(): This method tests if there are more tokens available from this tokenizer's string.


nextElement(): This method returns the nextToken of the String tokens.


nextToken(): This method returns the next token from this string tokenizer.


nextToken(String): This method returns the next token in this string tokenizer's string with the given delimiter.


No comments:

Post a Comment