$numtok
From Scriptwiki
Returns the number of tokens in a text.
$numtok(text,C)
The C parameter is the ascii value of the character separating the tokens.
Note that it's exactly the same as $gettok(text,0,C).
Example
echo -ag $numtok(This is a test,32)
This will return 4, as This is a test consists of 4 words.