xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

PosRepl()

Replaces characters in a string beginning at a specified position.

Syntax

PosRepl( <cString> , ;
         <cReplace>, ;
        [<nPos>]     ) --> cResult

Arguments

<cString>
This is the character string to replace one or more characters in.
<cReplace>
This is a character string of one or more characters that replaces characters in <cString>.
<nPos>
This is the numeric ordinal position of the first character in <cString> to start deleting from. It defaults to Len(<cString>)-Len(<cReplace>), i.e. <cReplace> replaces the characters at the end of <cString>.

Return

The function replaces <cReplace> at the specified position in <cString> and returns the modified string.

Info

See also:PosDel(), PosIns(), PosRange()
Category: CT:String manipulation , Character functions
Source:ct\pos2.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe