Public Shared Function CountChars(ByVal sString As String, ByVal sSearch As String) As Integer
Dim i As Integer = sString.Length - sString.Replace(sSearch, "").Length
Return i
End Function
Dim s1 As String = "Aaa Ha"
Dim r As RegularExpressions.Regex = _
New RegularExpressions.Regex("a", RegularExpressions.RegexOptions.IgnoreCase)
Dim matches As Integer = r.Matches(s1).Count
MessageBox.Show(matches) 'should display 4
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.