$SubCnt: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(34 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$SubCnt}}
{{DISPLAYTITLE:$SubCnt}}
<span class="pageSubtitle"><section begin="desc" />Count occurrences of one string in another<section end="desc" /></span>
<span class="pageSubtitle">Count occurrences of one string in another</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubCnt function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. There is currently no OO equivalent for the $SubCnt function.</p>


This function counts the occurrences of one string in another.  
This function counts the occurrences of one string in another.  


The $SubCnt function accepts two arguments and returns a numeric result that is the count of occurrences of the second argument string in the first argument string.  
==Syntax==
<p class="syntax"><span class="term">%count</span> = <span class="literal">$SubCnt</span>(<span class="term">string</span>, <span class="term">substring</span>)
</p>
 
===Syntax terms===
<table class="syntaxTable">
<tr><th>%count</th>
<td>The count of occurrences of <var class="term">substring</var> in <var class="term">string</var>.</td></tr>
 
<tr><th>string</th>
<td>An arbitrary string. </td></tr>


The first argument is an arbitrary string.  
<tr><th>substring</th>
<td>Another arbitrary string.</td></tr>
</table>


The second argument is another arbitrary string.
==Examples==
==Syntax==
The following statement would set %JUNK to 3:
<p class="syntax"><section begin="syntax" /> %COUNT = $SubCnt(string, substring)
<p class="code">%JUNK = $SubCnt('ABCDABAB', 'AB')
<section end="syntax" /></p>
<p class="caption">$SubCnt Function
</p>
</p>
<p class="caption">%COUNT is the count of occurrences of '''substring''' in '''string'''.</p>
 
For example
This statement would set %JUNK to 0:
<p class="code"> %JUNK = $SubCnt('ABCDABAB', 'AB')
<p class="code">%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'WEHAVE')
</p>
</p>
would set %JUNK to 3 and
 
<p class="code"> %JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', -
And this statement would set %JUNK to 4:
'WEHAVE')
<p class="code">%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'E')
</p>
</p>
would set %JUNK to 0 and
 
<p class="code"> %JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'E')
==Products authorizing {{PAGENAMEE}}==
</p>
would set %JUNK to 4.
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[List of $functions|Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
<p class="caption">Products authorizing $SubCnt
</p>




[[Category:$Functions|$SubCnt]]
[[Category:$Functions|$SubCnt]]

Latest revision as of 23:29, 20 September 2018

Count occurrences of one string in another

Note: Many $functions have been deprecated in favor of Object Oriented methods. There is currently no OO equivalent for the $SubCnt function.

This function counts the occurrences of one string in another.

Syntax

%count = $SubCnt(string, substring)

Syntax terms

%count The count of occurrences of substring in string.
string An arbitrary string.
substring Another arbitrary string.

Examples

The following statement would set %JUNK to 3:

%JUNK = $SubCnt('ABCDABAB', 'AB')

This statement would set %JUNK to 0:

%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'WEHAVE')

And this statement would set %JUNK to 4:

%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'E')

Products authorizing $SubCnt