xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

AtNum()

Searches multiple occurrences of a substring within a string.

Syntax

AtNum( <cSearch>   , ;
       <cString>   , ;
      [<nCount>]   , ;
      [<nSkipChars>] ) --> nPos

Arguments

<cSearch>
This is a character string to search for in <cString>.
<cString>
This is the character string to find <cSearch> in.
<nCount>
A numeric value indicating the number of occurrences of finding <cSearch> in <cString> before the function returns. It defaults to the last occurrence.
<nSkipChars>
This numeric parameter defaults to 0 so that the function begins searching with the first character of <cString>. Passing a value > 0 instructs the function to ignore the first <nSkipChars> characters in the search.

Return

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().

Info

See also:AfterAtNum(), AtRepl(), BeforAtNum(), NumAt(), CSetAtMuPa(), SetAtLike()
Category: CT:String manipulation , Character functions
Source:ct\atnum.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

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

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