以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 如何按照格式截取字符串 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=76279) |
-- 作者:ycli368 -- 发布时间:2015/10/26 10:32:00 -- 如何按照格式截取字符串 如何按照格式截取字符串 例如字符串规律是 abc:eeew:1321;3432; ::;;为一个单位,怎么截取
|
-- 作者:lsy -- 发布时间: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
|
-- 作者:ycli368 -- 发布时间:2015/10/26 10:54:00 -- 表述没完整,数据如下,我要按 :::;:; 为一个单元拆分出数据 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;
|
-- 作者:Hyphen -- 发布时间:2015/10/26 11:05:00 -- 用分号拆分,每2个索引为一组 |
-- 作者:lsy -- 发布时间: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
|
-- 作者:ycli368 -- 发布时间:2015/10/26 11:22:00 -- 太牛了,学习了 |