ASP 只擷取字串的數字

2021-08-30 05:47:27 字數 889 閱讀 5021

<%

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

asp擷取字串函式 asp怎麼擷取字串

asp擷取字串函式 asp怎麼擷取字串 擷取字串 strvalue 標題,字數 function strvalue str,lennum dim p num dim i if strlen str lennum then strvalue str else p num 0 x 0do while n...

擷取字串

static function blogsummary str,len 100 else out valtmp break tmp tmpstr outlen mb strlen valtmp,charset out val.rs 2 key right rs 2 key unset rs tags...

擷取字串

擷取字串一般使用string類的substring方法。public string substring int beginindex 返回該字串子串的新字串。子字串開始於指定的位置並且擴充套件到該字串的結尾。public string substring int beginindex,int end...