Click or drag to resize

GetWordCount Function (String)

X#
Counts the words in a string.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION GetWordCount(
	cString AS STRING
) AS LONG
Request Example View Source

Parameters

cString
Type: String
Specifies the string whose words will be counted.

Return Value

Type: Long
Numeric
Remarks
GetWordCount( ) by default assumes that words are delimited by spaces or tabs. If you specify another character as delimiter, this function ignores spaces and tabs and uses only the specified character. If you use "AAA aaa, BBB bbb, CCC ccc." as the target string for GetWordCount( ), you can get all the following results.
X#
1cString = "AAA aaa, BBB bbb, CCC ccc."
2? GetWordCount(cString)               // 6 - character groups, delimited by " "
3? GetWordCount(cString, ",")               // 3 - character groups, delimited by ","
4? GetWordCount(cString, ".")               // 1 - character group, delimited by "."
See Also