I'm trying to find how many CRLFs exist within a string. This is done MANY times, within a loop.
I'm calling the following function in order to get it done each time.
Is there a faster way?
Thanks!
I'm calling the following function in order to get it done each time.
Is there a faster way?
Thanks!
B4X:
Sub CountChars(value As String, ch As Char) As Int
Dim cnt As Int = 0
Dim c As Char
For i = 0 To value.Length-1
c=value.CharAt(i)
If (c = ch) Then cnt = cnt+ 1
Next
Return cnt
End Sub