CountLeft()
Count a certain character at the beginning of a string
Syntax
CountLeft( <cString>, [<cSearch|nSearch>] ) -> nCount
Arguments
<cString> Designates the character string in which the <cCharacter|nCharacter> character is counted.
<cSearch|nSearch> Designates the character at the beginning of the <cString> that is counted. The default value is a space, CHR(32).
Returns
CountLeft() returns the number of <cSearch|nSearch> characters that appear in an uninterrupted sequence at the beginning of <cString>.
Description
While RemLeft() removes leading characters from the <cString>, CountLeft() only determines the number of leading <cSearch|nSearch> characters appearing in an uninterrupted sequence at the beginning of the <cString>.
Examples
. Count the blanks: ? CountLeft(" 123") // Result: 3 . Count the "." characters: ? CountLeft("..4.123", ".") // Result: 2 . In this example, there is nothing to count: ? CountLeft("123456") // Result: 0
Compliance
CountLeft() is compatible with CT3’s CountLeft().
Platforms
All
Files
Source is count.c, library is libct.
Seealso
COUNTRIGHT()