Dim pos : pos = 0
Dim count : count = -1
Do
count = count + 1
pos = InStr(pos + 1, str, "@")
Loop While (pos > 0)
Ответ 3
Response.write ubound(split(str,"@"))
достаточно для подсчета наличия определенного символа
Ответ 4
Попробуйте цикл while:
Do While (str.indexOf("@") != -1)
count = count + 1
str = right(str, len(str) - str.indexOf("@"))
Loop
ИЗМЕНИТЬ
Этот цикл может иметь смысл:
dim strLen, curChar, count
count = 0
int strLen = len(str)
for i = 1 to strLen
curChar = mid(str, i, 1)
if curChar = "@"
count = count + 1
end if
next
Ответ 5
Заменить поиск пустым и найти разницу между исходной и новой строкой будет количество времени, в которое будет присутствовать строка
Dim a = "I @ am @ [email protected]"
Dim count
count = Len(a) - Len(Replace(a,"@",""))
Response.write count
Ответ 6
Function FnMatchedStringCountFromText(strText,strStringToSearch)
strLength = Len(strText)
strNumber = 1
IntCount = 0
For i = 1 to strLength
If Instr(1,strText,strStringToSearch,0) > 0 Then
stMatch = Instr(1,strText,strStringToSearch,0)
strText = Mid(strText,stMatch+2,strLength)
IntCount = IntCount+1
Else
Exit For
End If
Next
FnMatchedStringCountFromText = IntCount
End Function