StringTokenizer - Return Delimiters along with Tokens - Java Language Basics

Java examples for Language Basics:StringTokenizer

Description

StringTokenizer - Return Delimiters along with Tokens

Demo Code


import java.util.StringTokenizer;
 
public class Main {
 
  public static void main(String[] args) {
    StringTokenizer st = new StringTokenizer("Java|StringTokenizer|Example 1","|");
    while(st.hasMoreTokens())
      System.out.println(st.nextToken("|"));
 
  }/*www  .j av  a  2  s. c om*/
}

Result


Related Tutorials