$insert

Inserts a character string into another character string.

Syntax

$insert(source,position,string)

Parameters

source

a character string, or expression that evaluates to a character string

position

a number or an expression that evaluates to a number

string

a character string, or expression that evaluates to a character string

Return Value

Character string consisting of source, with string embedded starting at the specified position.

Comments

Use $insert to produce a string consisting of source, with string embedded starting at position.

In a string, the position of the first character is always 1. If position is beyond the end of source, then string is appended to source. If position is zero or negative, then source is left unchanged.

Example

$insert("12345",3,"abc")

Evaluates to "12abc345".

$insert("abc",1,"de")

Evaluates to "deabc".

$insert("abc",4,"def")

Evaluates to "abcdef".

$insert($delete("abcdef,2,2),2,"123")

Evaluates to "a123def".

 

Related Topics