xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

PosIns()

Inserts character(s) at a specified position in a string.

Syntax

PosIns( <cString>, ;
        <cInsert>, ;
       [<nPos>]    ) --> cResult

Arguments

<cString>
This is the character string to delete one or more characters from.
<cInsert>
This is a character string of one or more characters to be inserted.
<nPos>
This is the numeric ordinal position of the first character in <cString> to start deleting from. It defaults to Len(<cString>)+1, i.e. <cInsert> is appended to <cString>.

Return

The function inserts <cInsert> at the specified position into <cString> and returns the modified string.

Info

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

Example

// The example display results of PosIns()

   PROCEDURE Main
      LOCAL cStr := "This compiler"

      cStr := PosIns( cStr, "is the ", 6 )

      ? cStr         // result: This is the compiler

      cStr := PosIns( cStr, "xHarbour ", 13 )

      ? cStr         // result: This is the xHarbour compiler
   RETURN

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