1 22 23 24 package com.mchange.v1.util; 25 26 import java.util.StringTokenizer ; 27 28 public final class StringTokenizerUtils 29 { 30 public static String [] tokenizeToArray(String str, String delim, boolean returntokens) 31 { 32 StringTokenizer st = new StringTokenizer (str, delim, returntokens); 33 String [] strings = new String [st.countTokens()]; 34 for (int i = 0; st.hasMoreTokens(); ++i) 35 strings[i] = st.nextToken(); 36 return strings; 37 } 38 39 public static String [] tokenizeToArray(String str, String delim) 40 {return tokenizeToArray(str, delim, false);} 41 42 public static String [] tokenizeToArray(String str) 43 {return tokenizeToArray(str, " \t\r\n");} 44 } 45 46 47 48 49 | Popular Tags |