Here you can find the source of tokenize(String array, String delimiter)
Parameter | Description |
---|---|
array | Monotone string |
delimiter | String separator |
public static List<String> tokenize(String array, String delimiter)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**//from w w w . j a v a2 s . com * Split string into tokens using delimiter * @param array Monotone string * @param delimiter String separator * @return Array of tokens */ public static List<String> tokenize(String array, String delimiter) { final List<String> tokens = Arrays.asList(array.split("\\s*" + delimiter + "\\s*")); ArrayList<String> result = new ArrayList<>(); for (String token : tokens) { if (token != null && !token.trim().isEmpty()) { result.add(token.trim()); } } return result; } }