| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Replaces characters in a string beginning at a specified position.
PosRepl( <cString> , ;
<cReplace>, ;
[<nPos>] ) --> cResult
The function replaces <cReplace> at the specified position in <cString> and returns the modified string.
| See also: | PosDel(), PosIns(), PosRange() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\pos2.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays results of PosRepl()
PROCEDURE Maine
LOCAL cString := "12345678"
? PosRepl( cString, "ABC" ) // result: 12345ABC
? PosRepl( cString, "ABC", 2 ) // result: 1ABC5678
? PosRepl( cString, "ABC", 7 ) // result: 123456ABC
RETURN
http://www.xHarbour.com