Insert

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?

Adobe logo

Sign in to your account