| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Searches multiple occurrences of a substring within a string.
AtNum( <cSearch> , ;
<cString> , ;
[<nCount>] , ;
[<nSkipChars>] ) --> nPos
The function returns the ordinal position of the <nCount>th occurrence of <cSearch> in <cString> as a numeric value.
Note: if <nCount> is not specified, AtNum() returns the same result as function RAt().
| See also: | AfterAtNum(), AtRepl(), BeforAtNum(), NumAt(), CSetAtMuPa(), SetAtLike() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\atnum.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows results of AtNum()
PROCEDURE Main
LOCAL cString := "xHarbour Compiler"
? AtNum( "r", cString ) // result: 17
? AtNum( "r", cString, 1 ) // result: 4
? AtNum( "r", cString, 2 ) // result: 8
? AtNum( "r", cString, 3 ) // result: 17
? AtNum( "r", cString, 4 ) // result: 0
RETURN
http://www.xHarbour.com