Difference between revisions of "$numtok"

From Scriptwiki
Jump to: navigation, search
 
(typos)
 
Line 1: Line 1:
 
Returns the number of tokens in a text.
 
Returns the number of tokens in a text.
  $numtok(text,C
+
  $numtok(text,C)
 
The C parameter is the ascii value of the character separating the tokens.
 
The C parameter is the ascii value of the character separating the tokens.
  
Line 7: Line 7:
 
== Example ==
 
== Example ==
 
  [[echo]] -ag $numtok(This is a test,32)
 
  [[echo]] -ag $numtok(This is a test,32)
This will return 4, as ''This is a test'' constists of 4 words.
+
This will return 4, as ''This is a test'' consists of 4 words.
  
 
[[Category:Token Identifiers]]
 
[[Category:Token Identifiers]]

Latest revision as of 17:17, 16 October 2005

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.