$SubCnt: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 5: | Line 5: | ||
This function counts the occurrences of one string in another. | This function counts the occurrences of one string in another. | ||
==Syntax== | ==Syntax== | ||
Line 16: | Line 10: | ||
<section end="syntax" /></p> | <section end="syntax" /></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> | |||
<p class="code"> %JUNK = $SubCnt('ABCDABAB', 'AB') | <tr><th>substring</th> | ||
<td>Another arbitrary string.</td></tr> | |||
</table> | |||
==Examples== | |||
The following statement would set %JUNK to 3: | |||
<p class="code">%JUNK = $SubCnt('ABCDABAB', 'AB') | |||
</p> | </p> | ||
would set %JUNK to | This statement would set %JUNK to 0: | ||
<p class="code">%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'WEHAVE') | |||
<p class="code"> %JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', | |||
</p> | </p> | ||
would set %JUNK to | And this statement would set %JUNK to 4: | ||
<p class="code">%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'E') | |||
<p class="code"> %JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'E') | |||
</p> | </p> | ||
==Products authorizing $SubCnt== | |||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[Sirius functions]]</li> | ||
Line 44: | Line 45: | ||
<li>[[Japanese functions]]</li> | <li>[[Japanese functions]]</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Sir2000 Field Migration Facility]]</li> | ||
</ul> | |||
[[Category:$Functions|$SubCnt]] | [[Category:$Functions|$SubCnt]] |
Revision as of 23:01, 24 October 2012
Count occurrences of one string in another
Most Sirius $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
<section begin="syntax" />%count = $SubCnt(string, substring) <section end="syntax" />
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')