xHarbour Reference Documentation > Function Reference |
Locates the position of a substring within a character string.
At( <cSearch>, <cString>, [<nStart>], [<nEnd>] ) --> nPos
The function returns a numeric value which is the position in <cString> where <cSubString> is found. The return value is zero when <cSubString> is not found.
The function At() searches the string <cString> from left to right for the character string <cSearch>. The search begins at position <nStart> and is case-sensitive. If <cString> does not contain <cSearch>, the function returns 0.
Note: use function RAt() to search <cString> from right to left.
See also: | $, HB_ATokens(), AtSkipStrings(), HB_RegEx(), IN, Left(), RAt(), Right(), StrTran(), SubStr() |
Category: | Character functions |
Source: | rtl\at.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates various results of At(). PROCEDURE Main() LOCAL cString := "xHarbour" ? At( "Ha", cString ) // result: 2 ? At( "ARB" , cString ) // result: 0 ? At( "ARB" , Upper(cString) ) // result: 3 ? At( "r" , cString ) // result: 4 ? At( "r" , cString, 5 ) // result: 8 ? At( "r" , cString, 5, 7 ) // result: 0 RETURN
http://www.xHarbour.com