Package : java.util.StringTokenizer
Extends : java.lang.Object class
Implements : Enumeration
Brief Description : StringTokenizer in java is used to split or break a string into tokens based on a delimiter. Its methods do not distinguish among identifiers, numbers, and quoted strings.

Syntax :

public StringTokenizer(String str)
 or
public StringTokenizer(String str, String delim)
 or
public StringTokenizer(String str, String delim, boolean returnDelims)

Tutorial :

package com.javaindetail.tokenizertutorial;

import java.util.StringTokenizer;

public class SplitUsingTokenizer {

  public static void main(String[] args) {

    String str = "welcome-to-javaindetail.com";
    StringTokenizer strToken = new StringTokenizer(str, "-");
    // stringtokenizer in java
    System.out.println("Splitting using StringTokenizer with - as delimiter");
    while (strToken.hasMoreTokens()) {
      System.out.println(strToken.nextElement());
    }
  }

}

Output :

welcome
to
javaindetail.com