Here you can find the source of split(String str, String splitter)
Parameter | Description |
---|---|
str | Full string |
splitter | Characters to split on |
public static List<String> split(String str, String splitter)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**/*w ww .j a va 2 s. c o m*/ * Split a string into pieces based on delimiters. Similar to the perl function of * the same name. The delimiters are not included in the returned strings. * @see #join * * @param str Full string * @param splitter Characters to split on * @return List of String pieces from full string */ public static List<String> split(String str, String splitter) { StringTokenizer tokens = new StringTokenizer(str, splitter); ArrayList<String> l = new ArrayList<String>(tokens.countTokens()); while (tokens.hasMoreTokens()) { l.add(tokens.nextToken()); } return l; } }