Skip to main content

String Tokenizer Notes

 // String Tokenizer


Declaration


StringTokenizer str = new StringTokenizer(string value);


// Functions


hasMoreTokens() --> return boolean true/false


use--------

It checks if there is more tokens available


nextToken() ---> returns string/word


use-------------

It returns the next token from the string tokenizer object.

If only token is present then the current token is shown.


countTokens() ----> it returns total number of tokens.


By default the delimeter for string tokenizer is space " ".


Name,Class,Roll --> delimeter ,

Name Class ROll ---> delimeter " "



**It it present under java.util package

Popular posts from this blog