dim a() as string dim acount as integer dim i as integer '你的字符串 dim strx as string dim a_num as boolean
acount = 1 redim preserve a(1 to acount) for i = 1 to len(strx) if (asc(mid(strx, i, 1)) > = 48 and asc(mid(strx, i, 1)) <= 57) _ or asc(mid(strx, i, 1)) = 46 then a(acount) = a(acount) & mid(strx, i, 1) if a_num = false then a_num = true end if else if a_num = true then acount = acount + 1 redim preserve a(1 to acount) a_num = false end if end if next i
function myget(srg as string, optional n as integer = false, _ optional start_num as integer = 1) dim i as integer dim s as string dim mystring as string dim bol as boolean
for i = start_num to len(srg) s = mid(srg, i, 1) if n = 1 then bol = asc(s) < 0 '分離漢字 elseif n = 2 then bol = s like "[a-z,a-z, ] " '分離字母 elseif n = 0 then bol = s like "# " '分離數字 end if if bol then mystring = mystring & s next myget = iif(n = 1 or n = 2, mystring, val(mystring)) end function
发表于:2007-05-10 10:15:157楼 得分:5
这样简单点:
i=len(t) do while i> =1 if (asc(mid(t,i,1)) <asc( "0 ") or asc(mid(t,i,1))> asc( "9 ")) and asc(mid(t,i,1)) <> asc( ". ") then t=replace(t,mid(t,i,1), " ") i=i-1 loop
发表于:2007-05-10 10:20:368楼 得分:0
i=len(t) do while i> =1 if (asc(mid(t,i,1)) <asc( "0 ") or asc(mid(t,i,1))> asc( "9 ")) and asc(mid(t,i,1)) <> asc( ". ") then t=replace(t,mid(t,i,1), " ") i=i-1 if i> len(t) then i=len(t) loop