FUNCTIONS CORE
BeforAtNum()
Extract the part of a string before the last occurrence of a search string
Syntax
BeforAtNum( cSearch, cString, [nCount], [nSkipChars] ) --> cResultArguments
cSearch
cString
nCount
nSkipChars
Example
PROCEDURE Main()
LOCAL cPath := "C:\xDev\tests\BeforAtNum.prg"
Check( 'BeforAtNum( "\", cPath ) ', BeforAtNum( "\", cPath ), "C:\xDev\tests" )
Check( 'BeforAtNum( ".", "archive.tar.gz" ) ', BeforAtNum( ".", "archive.tar.gz" ), "archive.tar" )
Check( 'BeforAtNum( ".", "archive.tar.gz", 1 ) ', BeforAtNum( ".", "archive.tar.gz", 1 ), "archive" )
Check( 'BeforAtNum( "/", "archive.tar.gz" ) ', BeforAtNum( "/", "archive.tar.gz" ), "" )
RETURN
STATIC PROCEDURE Check( cTitle, xResult, xExpected )
QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )
RETURNOutput
BeforAtNum( "\", cPath ) OK
BeforAtNum( ".", "archive.tar.gz" ) OK
BeforAtNum( ".", "archive.tar.gz", 1 ) OK
BeforAtNum( "/", "archive.tar.gz" ) OK