分类:
2008-09-11 14:33:06
package net.java2000.tools;
/**
* Title: Bean 工具
* Description:
* Copyright: Copyright (c) 2001
* Company: JAVA世纪网
* @author 赵学庆
* @version 1.0
*/
import java.util.*;
import java.util.regex.Pattern;
public class StrTools {
/**
* 分割字符串
*
* @param str String 原始字符串
* @param splitsign String 分隔符
* @return String[] 分割后的字符串数组
*/
@SuppressWarnings("unchecked")
public static String[] split(String str, String splitsign) {
int index;
if (str == null || splitsign == null)
return null;
ArrayList al = new ArrayList();
while ((index = str.indexOf(splitsign)) != -1) {
al.add(str.substring(0, index));
str = str.substring(index + splitsign.length());
}
al.add(str);
return (String[]) al.toArray(new String[0]);
}
[1]