WordCount (function)

Syntax

WordCount(text$)

Description

Returns an Integer representing the number of words in the specified text.

Comments

Words are separated by spaces, tabs, and end-of-lines.

Example

This example counts the number of words in a particular string.

Sub Main()
  s$ = "My last name is Williams; Stuart is my surname."
  i% = WordCount(s$)
  MsgBox "'" & s$ & "' has " & i% & " words."
End Sub

See Also

Item$ (function); ItemCount (function); Line$ (function); LineCount (function); Word$ (function).

More information

W