| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Counts a specified character from the right side of a string.
CountRight( <cString>, [<xChar>] ) --> nCount
The function counts <xChar> at the end of <cString> and returns as soon as a different character is detected. The number of times the character <xChar> is found consecutively at the end of <cString> is returned as a numeric value.
| See also: | CountLeft(), RTrim() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\count.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays results of CountRight()
PROCEDURE Main
LOCAL cString1 := " Hello World "
LOCAL cString2 := "aaaaabbbbbcc"
? CountRight( cString1 ) // result: 1
? CountRight( cString2, "c" ) // result: 2
RETURN
http://www.xHarbour.com