TALLY function

Purpose: TALLY returns the number of times FindMainStr$ occurs in SourceMainStr$


 Syntax:

 RetVal% = TALLY(MainStr$, Match$ [,CaseSensitivity%])

 Parameters:

  • RetVal% Returned count of how many times Match$ occurs in MainStr$
  • MainStr$ String which is to be searched for Match$.
  • Match$ Substring to be located in MainStr$.
  • CaseSensitivity% [OPTIONAL] Set to 1 for case insensitive search. Default is 0 which is case sensitive.

Example 1: This snippet uses the TALLY function default case sensitive mode.


 DIM a$
 DIM b$
 DIM int1%
 
 a$ = " ABC abc AbC aBc "
 b$ = "abc"
 
 int1% = TALLY(a$, b$)
 PRINT int1%

Result:

1

Example 2: This snippet uses the TALLY function optional case insensitive mode.


 DIM a$
 DIM b$
 DIM int1%
 
 a$ = " ABC abc AbC aBc "
 b$ = "abc"
 
 int1% = TALLY(a$, b$, 1)
 PRINT int1%

Result:

4