如何表中的一个字段存的数据是'30','38','41'如何把30,38,41从这个字段里摘出来存入ArrayList里

wjy217213 2010-06-10 03:55:33
如何表中的一个字段存的数据是'30','38','41'如何把30,38,41从这个字段里摘出来???我想把它存入ArrayList里
...全文
135 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wjy217213 2010-06-11
  • 打赏
  • 举报
回复
我采用了2楼了,完全成功,5楼的也对,没试,谢谢大家了!1
mngzilin 2010-06-10
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 zhaocheng761115 的回复:]
string a = "'30','38','41'";
ArrayList al = new ArrayList();
string[] as = a.split(',');
for(int i=0;i<as.length;i++)
{
al.Add(Convert.ToInt32(as[i].ToString()));
}
[/Quote]。
wuyq11 2010-06-10
  • 打赏
  • 举报
回复
需要这样保存吗?
split(',')分割Replace
zhaocheng761115 2010-06-10
  • 打赏
  • 举报
回复
string a = "'30','38','41'";
ArrayList al = new ArrayList();
string[] as = a.split(',');
for(int i=0;i<as.length;i++)
{
al.Add(Convert.ToInt32(as[i].ToString()));
}
zoopark 2010-06-10
  • 打赏
  • 举报
回复
2楼正解
lostuser 2010-06-10
  • 打赏
  • 举报
回复
不知所云
  • 打赏
  • 举报
回复
string a = "'30','38','41'";
ArrayList al = new ArrayList();
MatchCollection mcl = Regex.Matches(a, "\\d+");
foreach(Match m in mcl)
{
al.Add(m.Value);
}
捷哥1999 2010-06-10
  • 打赏
  • 举报
回复
读取该字段,字符串判断,条件满足后,string.split方法分开每个数字,存入。

110,572

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧