以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 字段中取指定数值 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=104900) |
-- 作者:zoyong -- 发布时间:2017/8/8 10:28:00 -- 字段中取指定数值 按指定字段取值 大神帮帮忙,想将明细列取数指定值到另三列
|
-- 作者:有点色 -- 发布时间:2017/8/8 10:43:00 -- 参考代码,尽量用实例说明问题。
Dim str As String = "5102.001.002 其它业务收入 - 本地资料费 - 万里/部门:002.014 - 经营部_aabbcc工程" |
-- 作者:zoyong -- 发布时间:2017/8/8 12:23:00 -- Dim Tel As String = "5501.003.001 营业费用 - 福利费/部门:002.057 - 经营部_仙县淡竹至白塔污水管道工程(施工)(30万)/职员:04" Dim Parts() As String = Tel.Split(".") Output.Show(Parts(0)) Output.Show(Parts(1)) Output.Show(Parts(2)) 代码结果: 5501 003 001 营业费用 - 福利费/部门:002 想取数: 5501 003 001
|
-- 作者:有点甜 -- 发布时间:2017/8/8 12:51:00 -- Dim str As String = "5501.003.001 营业费用 - 福利费/部门:002.057 - 经营部_仙县淡竹至白塔污水管道工程(施工)(30万)/职员:04" Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "[0-9.]+( )+(?=.+?( -|/))") For i As Integer = 0 To mc.count-1 msgbox(mc(i).value) Next |
-- 作者:zoyong -- 发布时间:2017/8/9 8:27:00 -- Dim str As String = "5102.001.002 本地资料费 /部门:002.014 - 经营部_aabbcc工 - 万里/部门:002.014 -aabbcc工 - 万里/部门:002 - 经营部_aabbcc工程" Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=[0-9.]+( )+).+?(?= -|/)") For i As Integer = 0 To mc.count-1 msgbox(mc(i).value) Next 只提取 “本地资料费” 五个字,怎么改 现在代码是提取了三个字段
|
-- 作者:有点甜 -- 发布时间:2017/8/9 8:59:00 -- Dim str As String = "5102.001.002 本地资料费 /部门:002.014 - 经营部_aabbcc工 - 万里/部门:002.014 -aabbcc工 - 万里/部门:002 - 经营部_aabbcc工程" Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=[0-9.]+( )+).+?(?= -|/| /)") If mc.count>0 Then msgbox(mc(0).value) End If |
-- 作者:zoyong -- 发布时间:2017/10/8 17:22:00 -- [此贴子已经被作者于2017/10/8 17:22:28编辑过]
|
-- 作者:有点甜 -- 发布时间:2017/10/8 17:23:00 -- 7楼什么问题,如果还有问题,请继续发帖提问。 |