POSINS()
Insert characters at a certain position within a string
Syntax
POSINS( <cString>, <cInsert>, [<nPosition>] ) -> cString
Arguments
<cString> Designates the character string into which characters are inserted.
<cInsertstring> Designates the new characters that are inserted into <cString>.
<nPosition> Designates the position where the new characters are inserted within <cString>. The default value inserts the characters in front of the last character.
Returns
POSINS() returns the string with the inserted characters.
Description
You can use POSINS() to insert characters into an existing character string. The <cInsertstring> characters are inserted into the <cString> at the location specified by <nPosition>.
Note
. The resulting character string is longer than the original, so this function cannot be called by reference.
Examples
. Insert "123" at position 2: ? POSINS("abcdefgh", "123", 2) // "a123bcdefgh" . Insert "123" at position 8: ? POSINS("abcdefgh", "123", 8) // "abcdefg123h" . Give an erroneous position: ? POSINS("abcdefgh", "123", 10) // "abcdefgh"
Compliance
POSINS() is compatible with CT3’s POSINS().
Platforms
All
Files
Source is pos2.c, library is libct.
Seealso
POSCHAR, POSDEL(), POSREPL()
Pingback: Harbour String Functions | Viva Clipper !
Pingback: Harbour All Functions – P | Viva Clipper !