count() Function

The count() function returns the number of occurrences of str.exp2 within str.exp1.

Syntax

count(str.exp1, str.exp2)

Parameter(s)

str.exp1

Specifies the string expression in which to search for occurrences of str.exp2.

str.exp2

Specifies the string expression to locate within str.exp1.

Example(s)

This displays the number of spaces in the string held in the variable sentence, which is equal to 3.

sentence = "sam is home alone"

print count(sentence,’ ’)

See Also

dcount() Function

fold() Function

BASIC Functions

occurs() Function

procread Statement

Statements and Functions

String Expressions