Foxtable(狐表)用户栏目专家坐堂 → 如何按照格式截取字符串


  共有3076人关注过本帖树形打印复制链接

主题:如何按照格式截取字符串

帅哥哟,离线,有人找我吗?
lsy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2015/10/26 10:50:00 [显示全部帖子]

Dim str As String = "abc:eeew:1321;3432;fgh:rty:5467;0698"
Dim s As String
Do While str.Split(":").Length >= 2 AndAlso str.Split(";").Length >= 2
    s = str.Split(";")(0) & ";" & str.Split(";")(1)
    Output.Show(s)
    str = str.Replace(s,"").Trim(";")
Loop

 回到顶部
帅哥哟,离线,有人找我吗?
lsy
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2015/10/26 11:11:00 [显示全部帖子]

Dim str As String = "456:99:A158565QZ1:1627207:132069;20509:3273538;456:100:A158565QL1:1627207:28338;20509:3273538;456:95:A158565QZ2:1627207:132069;20509:3273539;456:98:A158565QL2:1627207:28338;20509:3273539;456:95:A158565QZ3:1627207:132069;20509:3273540;456:94:A158565QL3:1627207:28338;20509:3273540;456:98:A158565QZ4:1627207:132069;20509:3273541;456:98:A158565QL4:1627207:28338;20509:3273541;456:99:A158565QZ5:1627207:132069;20509:3273542;456:95:A158565QL5:1627207:28338;20509:3273542;"
Dim s As String
Do While str.Split(";").Length >= 2
    s = str.Split(";")(0) & ";" & str.Split(";")(1)
    Output.Show(s)
    str = str.Replace(s,"").Trim(";")
Loop

 回到顶部