5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:
性别:秘密
最后登录:2007-04-12
http://anlong.5d.cn/
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/11/01 | 对字符串数组拆分.
类别(ProGrammE)
|
评论
(0)
|
阅读(169)
|
发表于 21:23
vb里面有非常方便将字串拆分为数组的函数,但是java没有提供类似函数
这是我写的一个拆分函数,将字符串拆分到hashtable中
public static Hashtable spilt(String fieldsru, String tag)
{
Hashtable returnarray = new Hashtable();
char dot = tag.charAt(0);
String field;
field = fieldsru + dot;
int num = 0;
int field_len = field.length();
for (int i = 0; i < field_len; i++)
{
if (field.charAt(i) == dot)
{
num++;
}
}
int begin = 0;
int end;
for (int j = 0; j < num; j++)
{
end = field.indexOf(dot, begin);
returnarray.put(new Integer(j), field.substring(begin, end));
begin = end + 1;
}
return returnarray;
}
0
评论
Comments
日志分类
首页
[161]
AbouT
[22]
Article
[25]
ScHOoL
[20]
PCGamE
[2]
AmusEMent
[85]
ProGrammE
[7]