xHarbour Reference Documentation > Function Reference |
Searches and replaces a substring within a string.
AtRepl( <cSearch> , ; <cString> , ; <cReplace> , ; [<nCount>] , ; [<lOneOnly>] ) --> cResult
The function returns the modified string.
See also: | AtNum(), AtAdjust(), CSetAtMuPa(), SetAtLike() |
Category: | CT:String manipulation , Character functions |
Source: | ct\atrepl.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates return vales of AtRepl() PROCEDURE Main LOCAL cString := "ABC_ABC_ABC" ? AtRepl( "_", cString, "x" ) // result: ABCxABCxABC ? AtRepl( "_", cString, "x",, .T. ) // result: ABC_ABCxABC ? AtRepl( "AB", cString, "1", 2 ) // result: 1C_1C_ABC ? AtRepl( "AB", cString, "1", 2, .T. ) // result: ABC_1C_ABC RETURN
http://www.xHarbour.com