Share via


OCCURS( ) Function

Returns the number of times a character expression occurs within another character expression.

OCCURS(cSearchExpression, cExpressionSearched)

Return Values

Numeric

Parameters

  • cSearchExpression
    Specifies a character expression that OCCURS( ) searches for within cExpressionSearched.
  • cExpressionSearched
    Specifies the character expression OCCURS( ) searches for cSearchExpression.

Remarks

OCCURS( ) returns 0 (zero) if cSearchExpression isn't found within cExpressionSearched.

Example

STORE 'abracadabra' TO gcstring
CLEAR
? OCCURS('a', gcstring)  && Displays 5
? OCCURS('b', gcstring)  && Displays 2
? OCCURS('c', gcstring)  && Displays 1
? OCCURS('e', gcstring)  && Displays 0

See Also

$ Operator | AT( ) | ATLINE( ) | RAT( ) | RATLINE( ) | INLIST( )