- Home
·
- String Manipulation
·
- Returns the number of times a given string or character repeats in the whole string. Example: thisS
Returns the number of times a given string or character repeats in the whole string. Example: thisS
Returns the number of times a given string or character repeats in the whole string. Example: thisString = "This code is an excellent code."
Rate Returns the number of times a given string or character repeats in the whole string. Example: thisS
(1(1 Vote))
On Error GoTo finish
Dim myPos As Integer
Dim strCounter As Integer
strCounter = 0
Do
myPos = InStr(myPos + 1, thisString, thisStr)
If myPos <> 0 Then
strCounter = strCounter + 1
myPos = myPos + Len(thisStr)
End If
Loop While myPos <> 0
numTimesCharRepeats = strCounter
Exit Function
finish:
If Err <> 0 Then
Err = 0
numTimesCharRepeats = 0
Exit Function
End If
End Function
Returns the number of times a given string or character repeats in the whole string. Example: thisS Comments
No comments yet — be the first to post one!
Post a Comment