Whatever message this page gives is out now! Go check it out!

Insert

Last update:
May 18, 2026
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

Function syntax

Insert(substring, string, position)

See also

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>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page