Insert

The document contains the function description for the following:

Description

Inserts a substring in a string after a specified character position. If position = 0, prefixes the substring to the string.

Returns

A string.

Category

String functions

Function syntax

Insert(substring, string, position)

See also

RemoveCharsLen

Parameters

Parameter

Description

substring

A string or a variable that contains one. String to insert.

string

A string or a variable that contains one. String into which to insert substring.

position

Integer or variable; position in string after which to insert substring.

Example

<cfscript>
    stringToInsert="ColdFusion"
    string="Hello  .How are you?"
    position=7
    completeString=Insert(stringToInsert,string,position)
    writeOutput(completeString)
</cfscript>

Output

Hello ColdFusion.How are you?

_Insert function

Description

Inserts a string in a substring after a specified character position. If position = 0, prefixes the substring to the string.

Returns

A string.

Syntax

_insert(String str, String sub, int pos)

Parameters

Parameter

Description

string

A string or a variable that contains one. The string into which to insert the substring.

substring

A string or a variable that contains one. The string to insert.

position

Integer or variable; position in the string after which to insert substring.

Example

<cfscript>
    substring="ColdFusion"
    string="Hello  .How are you?"
    position=7
    completeString=_Insert(string,substring,position)
    writeOutput(completeString)
</cfscript>

 Adobe

Get help faster and easier

New user?