ITeye博客

ASP 只截取字符串的数字

haimav · 2009-09-28 14:15 · asp · ASP · Markdown

<%
function RegExpTestsp(str,pat)
     Dim r, Match, Matches
     Set r = New RegExp
     r.Pattern = pat
     r.IgnoreCase = false
     r.Global = True
     Set Matches = r.Execute(str)
     For Each Match in Matches
     RetStr = RetStr & Match.Value
     Next
     RegExpTestsp = RetStr
End function
Html2="4044.667767,108589.827011 鍖呭ご甯?姘戞棌瑗胯矾瑗垮崡80绫?鍥㈢粨鍔犳补绔欒タ鍖?0绫? "
pat="[\d]+"
Response.Write RegExpTestsp(Html2,pat)

%>

 

这是一个方法

<%

Html2="3088.266079,12440.195633 鏉 窞甯?鍑よ捣涓滆矾;鏉 窞甯備釜浣撳姵鍔ㄨ 呭崗浼氳タ鍖?0绫? "

Response.write mid(html2,1,instr(Html2," "))
Response.end
  
For N = 0 To Len(Html2)
    Na = N+1
    st=mid(Html2,Na,1)
  
    if st="." or st="," then
     st1=st1+st  
       elseif IsNumeric(st) then
    st1=st1+st  
     end if
Next

Response.write st1

%>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。