top
Loading...
一個檢測一個字符串在另一個字符串當中出現幾次的函數
U2 Forum rautinee原創$
$http://u2bbs.126.com$
一個網友問就寫了一個,:)
Function CheckTheChar(TheChar,TheString)
'TheChar="要檢測的字符串"
'TheString="待檢測的字符串"
if inStr(TheString,TheChar) then
for n =1 to Len(TheString)
if Mid(TheString,n,Len(TheChar))=TheChar then
CheckTheChar=CheckTheChar+1
End if
Next
CheckTheChar="這個字符"&CheckTheChar&"次"
else
CheckTheChar="0次"
end if
End Function
'++++++++++++++++
example:
Response.write CheckTheChar("大家","a224大家4a434a4大家654arewr4a4a")
----------------------------------------------------
ok enjoy it and good luck
北斗有巢氏 有巢氏北斗