Insert characters at a certain position within a string
POSINS( <cString>, <cInsert>, [<nPosition>] ) -> cString
<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.
POSINS() returns the string with the inserted characters.
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>.
. The resulting character string is longer than the original, so this function cannot be called by reference.
. 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"
POSINS() is compatible with CT3’s POSINS().
Source is pos2.c, library is libct.
POSCHAR, POSDEL(), POSREPL()