"Peter" <pe***@mclinn.com> schrieb:
What is the most efficient way to count occurances of charaters in
a string?
IE. Searching for ',' in a comma del file.
\\\
Dim n As Integer = CountOccurances(..., ","c)
..
..
..
Private Function CountOccurances( _
ByVal Text As String, _
ByVal Character As Char _
) As Integer
Dim Count As Integer
For Each c As Char In Text
If c = Character Then
Count += 1
End If
Next c
Return Count
End Function
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>