您的位置:程序门 -> vb ->



如何循环截取字段


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何循环截取字段
发表于:2007-12-24 18:29:56 楼主
例如:0 ¦% ¦chq200700190445 ¦% ¦肖先禄 ¦% ¦201 ¦% ¦0 ¦% ¦510231197012263973 ¦% ¦

如何循环截取两个 ¦ ¦之间的字段,除了%      
发表于:2007-12-24 18:34:491楼 得分:0
用split函数,然后去掉含有%的数据。
发表于:2007-12-25 08:37:122楼 得分:0
简单:
dim   strsource   as   string,   strtmp   as   string,   strfields()   as   string,   i   as   integer

strsource   =   "0   |%   |chq200700190445   |%   |肖先禄   |%   |201   |%   |0   |%   |510231197012263973   |%   |"
strtmp   =   replace(strsource,   " ¦%   ",   "")
strtmp   =   replace(strsource,   space(1),   "")
strfields   =   split(strtmp,   " ¦")

for   i   =   0   to   ubound(strfields)
      debug.print   strfields(i),
next   i
debug.print   ""
发表于:2007-12-25 09:31:083楼 得分:0
楼上的replace用的真好
发表于:2007-12-25 10:04:594楼 得分:0
谢谢   chenjl1031   和   of123   刚入这个行业,还请大家多多帮助
发表于:2007-12-25 10:15:215楼 得分:0
"0       |%       |chq200700190445       |%       |肖先禄       |%       |201       |%       |0       |%       |510231197012263973       |%       |"  

关键不止一行,是不是要把strsource定义为一个数组,然后循环。 ¦% ¦之间没有空格


快速检索

最新资讯
热门点击