Is there any function in VB6 that can be used to get the number of occurance of string1 in string2?
just like the occurs() function in foxpro. Thanks!
:)
Printable View
Is there any function in VB6 that can be used to get the number of occurance of string1 in string2?
just like the occurs() function in foxpro. Thanks!
:)
i don't know if theres on but I've just whipped this up according to your description
Hope this helpsCode:Private Function occurred(ByVal searched As String, ByVal searchstr As String) As Integer
Dim pos, count As Integer
Do
pos = InStr(pos + 1, searched, searchstr)
If pos <> 0 Then count = count + 1
Loop Until pos = 0
occurred = count
End Function
Sunny
wow thanks sunny!
what a quick reply!!
cool~~~~