$SubCnt

From m204wiki
Revision as of 17:36, 28 January 2011 by 198.242.244.47 (talk) (Created page with "{{DISPLAYTITLE:$SubCnt}} <span class="pageSubtitle"><section begin="desc" />Count occurrences of one string in another<section end="desc" /></span> <p class="warning">Most Siriu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<section begin="desc" />Count occurrences of one string in another<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SubCnt function is to be entered.

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" />

$SubCnt Function

%COUNT is the count of occurrences of substring in string.

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.

Products authorizing $SubCnt