Programmer Guide/Command Reference/WORDS: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==WORDS==
{{PG_StringCommands}}
 
The {{STx}} comnmand <code>WORDS</code> returns the number of arguments ("words" in a broader, or more technical, meaning) supplied to the command.
<code><var>var</var> := WORDS <var>wordList</var></code>
<var>var</var> := WORDS <var>arg<sub>1</sub></var> <var>arg<sub>2</sub></var> &hellip; <var>arg<sub>n</sub></var>
 
Note the difference between what is called a word in everyday-use, and what is called a word (an argument) here:
-> var = 'numberOfWords'
Generally, if you supply <var>n</var> arguments to the <code>WORDS</code> command, it will return the number <var>n</var>, even if one of the arguments should consist of more than one "word" of natural language.
 
#v1 := WORDS don`'t come easy      // #v1 will be set to 3
Return the number of blank separated words in the list <var>wordList</var>.
#v2 := WORDS 'don`'t come' easy    // #v2 will be set to 2
#v3 := WORDS 'don`'t' 'come easy'  // #v3 will be set to 2, too
#v4 := WORDS 'don`'t come easy'    // #v4 will be set to 1

Latest revision as of 10:27, 4 March 2016

The STx comnmand WORDS returns the number of arguments ("words" in a broader, or more technical, meaning) supplied to the command.

var := WORDS arg1 arg2argn

Note the difference between what is called a word in everyday-use, and what is called a word (an argument) here: Generally, if you supply n arguments to the WORDS command, it will return the number n, even if one of the arguments should consist of more than one "word" of natural language.

#v1 := WORDS don`'t come easy       // #v1 will be set to 3
#v2 := WORDS 'don`'t come' easy     // #v2 will be set to 2
#v3 := WORDS 'don`'t' 'come easy'   // #v3 will be set to 2, too
#v4 := WORDS 'don`'t come easy'     // #v4 will be set to 1

Navigation menu

Personal tools