3.2.19. COUNTSTR(needle,haystack)

This function was introduced with the REXX ANSI Standard.  It
returns a count of the number of occurrences of needle in haystack
that do not overlap.

     COUNTSTR(‘’, ‘’)                   ->   0
     COUNTSTR(‘a’, ‘abcdef’)            ->   1
     COUNTSTR(0, 0)                ->   1
     COUNTSTR(‘a’, ‘def’)               ->   0
     COUNTSTR(‘a’, ‘’)                  ->   0
     COUNTSTR(‘’, ‘def’)           ->   0
     COUNTSTR(‘abc’, ‘abcdef’)          ->   1
     COUNTSTR(‘abcdefg’, ‘abcdef’       ->   0
     COUNTSTR(‘abc’, ‘abcdefabccdabcd’) ->   3



PREV NEXT