Added README file
[metux-java.git] / util / StrSplit.java
blob411eefbbbb685f4316a13bd94b31c8317f0afa8b
2 package org.de.metux.util;
4 import java.util.*;
6 public class StrSplit
8 /* a little workaround against missing regex in current libgcj */
9 public static String[] split(String str)
11 // if (str==null)
12 // return split("");
14 StringTokenizer tok = new StringTokenizer(str);
15 String[] list = new String[tok.countTokens()];
17 for (int x=0; tok.hasMoreTokens(); x++)
18 list[x] = tok.nextToken();
20 return list;
23 public static String[] split(String str, String delimiter)
25 // if (str==null)
26 // return split("");
28 StringTokenizer tok = new StringTokenizer(str,delimiter);
29 String[] list = new String[tok.countTokens()];
31 for (int x=0; tok.hasMoreTokens(); x++)
32 list[x] = tok.nextToken();
34 return list;