delimiters (the characters that separate tokens)
StringTokenizer是按delimiters中的每一个字符分解的, 如StringTokenizer st = new StringTokenizer("a3bc1def1gh", "13"); 分解的结果是a,bc,def,gh
StringTokenizer是按delimiters中的每一个字符分解的, 如StringTokenizer st = new StringTokenizer("a3bc1def1gh", "13"); 分解的结果是a,bc,def,gh
中,"@@"是个终止付串.它的每个字符都是终止附;
"@_ ,"这个字符串代表:'@',',',' ','_'这四个字符都是终止符.
没有解决办法吗??
{
if(s == null)
throw new NullPointerException("source String cannot be null");
if(separator == null)
throw new NullPointerException("separator cannot be null");
if(separator.length() == 0)
throw new IllegalArgumentException("separator cannot be empty"); ArrayList tmp = new ArrayList();
int start = 0;
int separatorLen = separator.length();
int end = s.indexOf(separator);
while(end != -1)
{
tmp.add(s.substring(start, end));
start = end + separatorLen;
end = s.indexOf(separator, start);
}
tmp.add(s.substring(start, s.length()));
String[] result = new String[tmp.size()];
tmp.toArray(result);
return result;
}public static void main(String[] args)
{
String[] result = split("a,,b,c,,d", ",");
for(int i=0; i<result.length; i++)
System.out.println(result[i]);
}
要知道unicode的最多可以有2^16=65536个哪,我想总有几个适合你
难难难
结贴了