POSINS()

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()

2 responses to “POSINS()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – P | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.