$Words: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
m (Removed the random Greek letters)
Line 2: Line 2:
<b>Syntax</b>
<b>Syntax</b>
<p>The format of the $WORDS function is:</p>
<p>The format of the $WORDS function is:</p>
<p class="code">$WORDS('inputstring', <var>[&#x220D;&#x03B4;</var>elimiter'<var>]</var>)
<p class="code">$WORDS('inputstring', <var>[</var>'delimiter'<var>]</var>)
</p>
</p>
<p>where:</p>
<p>where:</p>

Revision as of 17:57, 3 April 2014

The $WORDS function returns the number of words in a specified string, delimited by a blank or optionally specified character.

Syntax

The format of the $WORDS function is:

$WORDS('inputstring', ['delimiter'])

where:

  • inputstring is the input from which the specified word is to be extracted. inputstring can be a quoted literal or a %variable.
  • delimiter is an optional character to be used as a delimiter in parsing the input string into words. If delimiter is not specified, it defaults to a blank space.

Usage

Null values between delimiters are not considered words. For example,

$WORDS('ABC==D=XXX','=')

returns a count of three words, not four.

Example

The following function returns 4, the number of words in the string when a blank delimits a word:

$WORDS ('NOW IS THE TIME')