$SubCnt: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$SubCnt}} | {{DISPLAYTITLE:$SubCnt}} | ||
<span class="pageSubtitle" | <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. There is currently no OO equivalent for the $SubCnt function.</p> | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is currently no OO equivalent for the $SubCnt function.</p> |
Revision as of 21:22, 22 November 2011
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.
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.
The first argument is an arbitrary string.
The second argument is another arbitrary string.
Syntax
<section begin="syntax" /> %COUNT = $SubCnt(string, substring) <section end="syntax" />
For example
%JUNK = $SubCnt('ABCDABAB', 'AB')
would set %JUNK to 3 and
%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', - 'WEHAVE')
would set %JUNK to 0 and
%JUNK = $SubCnt('WE HAVE WAITED LONG ENOUGH', 'E')
would set %JUNK to 4.