CharCount

Description:              This function returns the number of bytes in a section of a buffer that matches a search character.

Returns:                    Numeric

Usage:                       Script or Steady State

Format:                      CharCount(Buffer, Offset, N, Match)

Parameters:             Buffer    { text }  { required }  { no default: }

                                                Any text expression giving the buffer to search.

                                    Offset    { numeric }  { required }  { no default: }

                                                Any numeric expression giving the starting buffer position for the CharCount, starting at 0.

                                    N    { numeric }  { required }  { no default: }

                                                Any numeric expression giving the number of bytes to include in the search.

                                    Match    { numeric }  { required }  { no default: }

                                                Any numeric expression giving the byte 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).

See Also:

Locate | Replace