CharCount

(Engine-Level Function)

Description: Returns the number of bytes in a section of a buffer that matches a search character.
Returns: Numeric
Usage: Script or steady state.
Function Groups: String and Buffer
Related to: Locate | Replace
Format: CharCount(Buffer, Offset, N, Match)
Parameters:  
Buffer
Required. Any text expression giving the buffer to search.
Offset
Required. Any numeric expression giving the starting buffer position for the CharCount, starting at 0.
N
Required. Any numeric expression giving the number of bytes to include in the search.
Match
Required. Any numeric expression giving the byte (usually an ASCII code) for which to search. Match must be in the range of 0 to 255.
Comments: Offset + N must be less than or equal to the buffer length, or the return value will be invalid.

Example:

  Num = CharCount("abcdefABCDEFc" { Search buffer },
                  0 { Start of the buffer }, 
                  13 { Search the entire buffer },
                  0x63 { Find the character "c" }); 

Num is set to 2 (the two lower case "c"s match but the upper case "C" doesn't).