VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Lightning Fast Word Counting

Chris_Lucas  (5 Submissions)   String Manipulation   Visual Basic 3.0   Advanced   Wed 3rd February 2021

A small ultra-fast function used to count the number of words in a string.

Inputs
Text -the string in which to count words

Returns
The number of words counted is returned as the value of the function itself (as a long).

Side Effects
As this function makes use of CopyMemory it should be allowed to run until finished. Stopping the project in the IDE could result in VB crashing (as with ALL API calls).

API Declarations
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
Destination As Any, _
Source As Any, _
ByVal Length As Long)

Rate Lightning Fast Word Counting (4(4 Vote))
Lightning Fast Word Counting.bas

Lightning Fast Word Counting Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters