如果不查JDK API,我很难写出来!我可以说说我的思路:
1. 用正则表达式,代码大概为:String [] result = orgStr.split(“,”);
2. 用 StingTokenizer ,代码为:StringTokenizer tokener = StringTokenizer(orgStr,”,”);
String [] result = new String[tokener .countTokens()];
Int i=0;
while(tokener.hasNext(){result[i++]=toker.nextToken();}
|
|