凤来仪

专业的计算机学习网站

首页 > ASP根据非数字分割字符串

ASP根据非数字分割字符串

点击:814 发布时间:

    笔者在编程过程中,遇到需要将字符串按照非数字分割的情况。将编写的代码记录下来,供有需要的朋友参考。

theString="12345$678910#13579*246810"
if theString<>"" then
    for i=1 to len(theString)
        if not isnumeric(mid(theString,i,1)) then
          theString=replace(theString,mid(theString,i,1),",")
        end if
    next
    if instr(theString,",")=0 then
        response.write theString&chr(13)
    else
        theString0=split(theString,",")
        for i=0 to ubound(theString0)
            response.write theString0(i)&chr(13)
        next
    end if
end if