$Words: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Removed the random Greek letters)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<p>The $WORDS function returns the number of words in a specified string, delimited by a blank or optionally specified character.</p>
<p>
<b>Syntax</b>
The <var>$Words</var> function returns the number of words in a specified string, delimited by a blank or optionally specified character.</p>
<p>The format of the $WORDS function is:</p>
 
<p class="code">$WORDS('inputstring', <var>[</var>'delimiter'<var>]</var>)
==Syntax==
<p>The format of the <var>$Words</var> function is:</p>
<p class="syntax">$Words('<span class="term">inputstring</span>', ['<span class="term">delimiter'</span>])
</p>
</p>
<p>where:</p>
<p>Where:</p>
<ul>
<ul>
<li>inputstring is the input from which the specified word is to be extracted. inputstring can be a quoted literal or a %variable.</li>
<li><var class="term">inputstring</var> is the input from which the specified word is to be extracted. <var class="term">inputstring</var> can be a quoted literal or a %variable.</li>
</li>
 
<li>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. </li>
<li><var class="term">delimiter</var> is an optional character to be used as a delimiter in parsing the input string into words. If <var class="term">delimiter</var> is not specified, it defaults to a blank space.  
</li>
</li>
</ul>
</ul>
<b>Usage</b>
 
<p>Null values between delimiters are not considered words. For example,</p>
==Usage==
<p class="code">$WORDS('ABC==D=XXX','=')
<p>
Null values between delimiters are not considered words. For example,</p>
<p class="code">$Words('ABC==D=XXX','=')
</p>
</p>
<p>returns a count of three words, not four.</p>
<p>returns a count of three words, not four.</p>
<b>Example</b>
 
<p>The following function returns 4, the number of words in the string when a blank delimits a word:</p>
==Example==
<p class="code">$WORDS ('NOW IS THE TIME')
<p>
The following function returns 4, the number of words in the string when a blank delimits a word:</p>
<p class="code">$words ('NOW IS THE TIME')
</p>
</p>
[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 15:34, 18 August 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')