Private lStartTime(10) As Long
Public Sub StartSW(iIndex As Int)
lStartTime(iIndex) = DateTime.Now
End Sub
Public Sub StopSW(iIndex As Int) As Long
Return DateTime.Now - lStartTime(iIndex)
End Sub
Sub MakeString2(btByte1 As Byte, btByte2 As Byte, lNum As Long) As String
Dim i As Long
Dim arrBytes(lNum * 2) As Byte
For i = 0 To lNum - 1 Step 2
arrBytes(i) = btByte1
Next
For i = 1 To lNum - 1 Step 2
arrBytes(i) = btByte2
Next
Return BC.StringFromBytes(arrBytes, "ASCII")
End Sub
Sub TestCountChar
Dim i As Long
Dim str As String
Dim lCount As Long
Dim arrBytes() As Byte
str = MakeString2(97, 44, 10000000)
General.StartSW(0)
Dim arrName() As String = Regex.Split(",", str)
lCount = arrName.Length - 1
Log("count: " & lCount & " time: " & General.StopSW(0))
General.StartSW(0)
arrBytes = str.GetBytes("ASCII")
lCount = 0
For i = 0 To arrBytes.Length - 1
If arrBytes(i) = 44 Then
lCount = lCount + 1
End If
Next
Log("count: " & lCount & " time: " & General.StopSW(0))
End Sub