R
Ronald
Hi there,
I would like to challenge you all to make the fastest tally-function
possible. The function should count the number of times a
specified string is present within another string. As I'm a Visual Basic
programmer I think i've reached the limits of performance from VB. In VB the
fastest (until now) function looks like this:
----------------------------------------------------------------------------
Function Tally(ByVal sString As String, ByVal sQuery As String) As Long
Dim ctr As Long
Dim pos As Long
sString = UCase(sString)
sQuery = UCase(sQuery)
Do
pos = InStr(pos + 1, sString, sQuery)
If pos Then ctr = ctr + 1
Loop Until pos = 0
Tally = ctr
End Function
----------------------------------------------------------------------------
Though, as this function is still not as fast as I think it can be I
would challenge everyone to write a faster one. As C++ is a better
performing language I think you all can help me.
Regards,
Ronald
I would like to challenge you all to make the fastest tally-function
possible. The function should count the number of times a
specified string is present within another string. As I'm a Visual Basic
programmer I think i've reached the limits of performance from VB. In VB the
fastest (until now) function looks like this:
----------------------------------------------------------------------------
Function Tally(ByVal sString As String, ByVal sQuery As String) As Long
Dim ctr As Long
Dim pos As Long
sString = UCase(sString)
sQuery = UCase(sQuery)
Do
pos = InStr(pos + 1, sString, sQuery)
If pos Then ctr = ctr + 1
Loop Until pos = 0
Tally = ctr
End Function
----------------------------------------------------------------------------
Though, as this function is still not as fast as I think it can be I
would challenge everyone to write a faster one. As C++ is a better
performing language I think you all can help me.
Regards,
Ronald