ccount

Counts the occurrences of one character in a data file before the next occurrence of a terminal character.

Syntax

ccount("c", "d")

Inputs

c
The character to count occurrences of
d
The terminal character (counting stops when this is found)

Comments

Unlike the count function, ccount tallies the number of occurrences of the target, rather than the number of lines in which it occurs.

ccount keeps track of the number of times character c appears before character d is reached (or the end of the file).

If character c is never encountered, a failure condition is generated.

After the count is over, the current file position is set to the terminal character (d) or the end of the file.

Examples

set qs = ccount("q", ".") // counts the number of q's before the next period