GT_CHRTOTAL()

Find number of times a set of characters appears in a string

Syntax

GT_ChrTotal(<cChrs>, <cStr>) --> nTotOcc

Arguments

<cChrs> - The set of characters <cStr> - The string to search

Returns

<nTotOcc> - The number of times the characters specified in <cChrs> appears in <cStr>

Description

Returns the numnber of occurrences of characters belonging to the set <cChrs> in the string <cStr>. If no characters in <cChrs> appears in <cStr> GT_ChrTotal() will return 0.

NOTE: invalid parameters will return -1
Examples
       local cStr1 := "the cat sat on the mat"

       ? GT_ChrTotal("tae", cStr1)            // prints 10
       ? GT_ChrTotal("zqw", cStr1)            // prints  0
Status

Ready

Files

Library is libgt