FUNCTIONS CORE

ReplAll()

Replace a specified character on both sides of a string

Syntax

Signature
ReplAll( cString, xReplace, [xSearch] ) --> cResult

Arguments

cString

xReplace

xSearch

Example

ReplAll.prg
PROCEDURE Main()

   Check( 'ReplAll( "  42  ", "*" )      ', ReplAll( "  42  ", "*" ), "**42**" )
   Check( 'ReplAll( "--42--", " ", "-" ) ', ReplAll( "--42--", " ", "-" ), "  42  " )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

ReplAll( "  42  ", "*" )      OK
ReplAll( "--42--", " ", "-" ) OK