Function String Words Class

CountWords

Count the alphanumeric words within a string. Function considers each sequence of one or more alphanumeric characters to be a word.

Signature (Visual Basic / VBA)

Public Function CountWords( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    CountWords("This is a test.") = 4
    CountWords("") = 0

Parameters

Parameter Description
vValue String containing alphanumeric words that should be counted. Function returns Null if vValue is Null or cannot be fixed up to a String.

Notes & Version History

Note Function uses the built-in character classification routines to determine which characters are alphanumeric.