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?

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy