Visual Basic .NET » Classic Visual Basic
Count how many times a string occurs in a text string?
So do you want find a substring occurs in a text string? I got this code from other forum, maybe this will help you.. Function CountSubString(StringIn As String, SubString As String) As Long Dim pos As Long pos = InStr(StringIn, SubString) Do While pos CountSubString = CountSubString + 1 pos = pos + Len(SubString) If pos < Len(StringIn) Then pos = Ins

[Page 1]
Home