GetWordCount Function (String, String) | |
Counts the words in a string.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax FUNCTION GetWordCount(
cString AS STRING,
cDelimiters AS STRING
) AS LONG
public static int GetWordCount(
string cString,
string cDelimiters
)
Request Example
View SourceParameters
- cString
- Type: String
Specifies the string whose words will be counted.
- cDelimiters
- Type: String
Optional. Specifies one or more optional characters used to separate words in cString. The default delimiters are space, tab, carriage return, and line feed. Note that GetWordCount( ) uses each of the characters in cDelimiters as individual delimiters, not the entire string as a single delimiter.
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.
1cString = "AAA aaa, BBB bbb, CCC ccc."
2? GetWordCount(cString)
3? GetWordCount(cString, ",")
4? GetWordCount(cString, ".")
See Also