

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to split a Java String into tokens with StringTokenizer?
The hasMoreTokens() method is used to test if there are more tokens available from this tokenizer's string.
Example
import java.util.*; public class StringTokenizerDemo { public static void main(String[] args) { // creating string tokenizer StringTokenizer st = new StringTokenizer("Come to learn"); // checking elements while (st.hasMoreElements()) { System.out.println("Next element : " + st.nextElement()); } } }
Output
Next element : Come Next element : to Next element : learn
- Related Questions & Answers
- Java StringTokenizer and String Split Example.
- Substitute tokens in a String in Java
- Java Program to split a string with dot
- How to split a string in Java?
- How to split a String into an array in Kotlin?
- Split string into groups - JavaScript
- How to split a string into elements of a string array in C#?
- How to split a string column into multiple columns in R?
- Split String with Dot (.) in Java
- Split String with Comma (,) in Java
- How to Split a String with Escaped Delimiters?
- Split string into equal parts JavaScript
- How to split a string with a string delimiter in C#?
- Split a string in Java
- Java Program to Split a list into Two Halves
Advertisements