hb_RAt()
Searches for last occurrence a substring of a string.
Syntax
hb_RAt( <cSearch>, <cString>, [<nStart>], [<nEnd>] ) --> nPos
Arguments
<cSearch> Substring to search for
<cString> Main string
<nStart> First position to search in cString, by default 1.
<nEnd> End position to search, by default cString length
Returns
hb_RAt() return the location of beginning position of last occurrence a substring of a string.
Description
This function searches for last occurrence a <cSearch> in <cString>. If the function is unable to find any occurrence of <cSearch> in <cString>, the return value is 0. 3rd and 4th parameters define inclusive range for 2nd parameter on which operation is performed. If 3rd and 4th parameters is not specified, then hb_RAt() is equal to RAt().
Examples
LOCAL cString LOCAL cSearch LOCAL i, y, r, nLen ? 'hb_RAt( "cde", "abcdefgfedcba" ) = ', ; hb_RAt( "cde", "abcdefgfedcba" ) // -> 3 cString := "acdefcdeedcb" cSearch := "cde" nLen := Len( cString ) FOR y := 1 TO nLen FOR i := 1 TO nLen r := hb_RAt( cSearch, cString, y, i ) IF r != 0 ? 'hb_RAt( "' + cSearch + '", "' + cString + '", ' + hb_ntos( y ) + ', ' + hb_ntos( i ) + ' ) = ' + ; hb_ntos( r ) ENDIF NEXT NEXT
Compliance
Clipper
Platforms
All(64K)
Files
Library is core
Seealso
hb_At(), SubStr(), Right(), RAt()
Pingback: Harbour All Functions – H | Viva Clipper !
Pingback: Harbour String Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !