xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

CountRight()

Counts a specified character from the right side of a string.

Syntax

CountRight( <cString>, [<xChar>] ) --> nCount

Arguments

<cString>
This is the character string to process.
<xChar>
A single character or its numeric ASCII code can be passed. The default value is a space character (Chr(32)).

Return

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.

Info

See also:CountLeft(), RTrim()
Category: CT:String manipulation , Character functions
Source:ct\count.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe