StringTokenizer in Java
The StringTokenizer class of java.util package, allows an application to split or break a string into small parts by defined delimiter ( space is the default delimiter). Each part of the splited string is called a token . This is particularly helpful for text processing where you need to split a string into several parts and use each part as an element for individual processing.
From the javadocs:
- StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.
The following Java program split the given string with space as delimiter
Example
Output
StringTokenizer with coma(,) as delimiter
Output
How to read and parse CSV file
The following program read a CSV file and split the character with coma(,) delimiter