Difference between revisions of "GETWORDNUM()"
From Lianjapedia
(Created page with '==Purpose== Function to return the number of words in a string ==Syntax== GETWORDNUM(<expC1> [, <expC2>]) ==See Also== AT(), ATNEXT(), GETWORDCOUNT(), INLIST(),…') |
|||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
− | GETWORDNUM(<expC1> [, <expC2>]) | + | GETWORDNUM(<expC1>, <expN> [, <expC2>]) |
==See Also== | ==See Also== | ||
Line 9: | Line 9: | ||
==Description== | ==Description== | ||
− | GETWORDNUM() returns the | + | GETWORDNUM() returns the word at the specified position <expN> in the string <expC1>. By default, words are assumed to be separated by spaces, tabs, line feeds or carriage returns. Alternative delimiting characters can be specified in <expC2>. If more than one delimiting character is included in <expC2>, each is counted as a delimiter, not the complete string as a single delimiter. If no word exists at position <expN>, GETWORDNUM() returns an empty string. |
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
cString = "AAA aaa, BBB bbb, CCC ccc. DDD ddd." | cString = "AAA aaa, BBB bbb, CCC ccc. DDD ddd." | ||
− | ? | + | ? getwordnum(cString,2) // 'aaa,' |
− | ? | + | ? getwordnum(cString,2, ",") // ' BBB bbb' |
− | ? | + | ? getwordnum(cString,2, ".") // ' DDD ddd' |
− | ? | + | ? getwordnum(cString,3, ",.") // ' CCC ccc' |
</code> | </code> | ||
Revision as of 10:52, 14 November 2012
Contents
Purpose
Function to return the number of words in a string
Syntax
GETWORDNUM(<expC1>, <expN> [, <expC2>])
See Also
AT(), ATNEXT(), GETWORDCOUNT(), INLIST(), LEFT(), OCCURS(), RAT(), RIGHT(), SET STRESCAPE, STR(), STREXTRACT(), STRPOS(), STRTRAN(), STUFF(), SUBSTR()
Description
GETWORDNUM() returns the word at the specified position <expN> in the string <expC1>. By default, words are assumed to be separated by spaces, tabs, line feeds or carriage returns. Alternative delimiting characters can be specified in <expC2>. If more than one delimiting character is included in <expC2>, each is counted as a delimiter, not the complete string as a single delimiter. If no word exists at position <expN>, GETWORDNUM() returns an empty string.
Example
cString = "AAA aaa, BBB bbb, CCC ccc. DDD ddd." ? getwordnum(cString,2) // 'aaa,' ? getwordnum(cString,2, ",") // ' BBB bbb' ? getwordnum(cString,2, ".") // ' DDD ddd' ? getwordnum(cString,3, ",.") // ' CCC ccc'