| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Returns the position of the n-th token in a string.
AtToken( <cString> , ;
[<cDelimiter>], ;
[<nCount>] ) --> nPos
The function returns the position of the <nCount>th token within <cString> as a numeric value, or zero when no more tokens exist. A token is a sequence of characters in <cString> delimited with one or two characters of <cDelimiter>.
| See also: | HB_ATokens(), NumToken(), Token(), TokenLower(), TokenUpper() |
| Category: | CT:String manipulation , Character functions , Token functions |
| Source: | ct\token1.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays substrings extracted from a
// tokenized string
PROCEDURE Main
LOCAL cDate := DtoC( StoD( "20061231" ) )
LOCAL cTime := Time()
LOCAL cFile := "Test.prg"
? cDate // result: 12/31/06
? SubStr( cDate, AtToken( cDate,, 3 ) ) // result: 06
? cTime // result: 18:14:01
? SubStr( cTime, AtToken( cTime,, 2 ) ) // result: 14:01
? cFile // result: Test.prg
? SubStr( cFile, AtToken( cFile ) ) // result: prg
RETURN
http://www.xHarbour.com