如何判断某字符串在另一个字符串中第几次出现的位置
如何判断某字符串在另一个字符串中 某(自己设置) 次出现的位置
Function StrSite(Str,Word,TimesNo)
Dim Times,WordLen
Times = 0
WordLen = Len(Word)
For i = 1 To Len(Str)+1-WordLen
If Mid(Str,i,WordLen) = Word Then
Times = Times + 1
If Times = TimesNo Then Exit For
End If
Next
StrSite = i
End Function
%>
<%=StrSite("adfasdfasdfasdfasdfasdfasdfa","as",4)%>
返回16
[此贴子已经被作者于2007-3-22 16:15:05编辑过]