Skip to main content
Version: 20 R7 BETA

Insert string

Insert string ( source ; what ; where ) : Text

ParameterTypeDescription
sourceTextString in which to insert the other string
whatTextString to insert
whereIntegerWhere to insert
Function resultTextResulting string

Description

Insert string inserts a string into source and returns the resulting string.inserts the string what before the character at position where.

If what is an empty string (""), Insert string returns source unchanged.

If where is greater than the length of source, then what is appended to source. If where is less than one (1), then what is inserted before source.

Insert string is different from Change string in that it inserts characters instead of overwriting them.

Example

The following example illustrates the use of Insert string. The results are assigned to the variable vtResult.

 vtResult:=Insert string("The tree";" green";4) // vtResult gets "The green tree"
 vtResult:=Insert string("Shut";"o";3) // vtResult gets "Shout"
 vtResult:=Insert string("Indention";"ta";6) // vtResult gets "Indentation"

See also

Change string
Delete string
Replace string

Properties

Command number231
Thread safe