Insert()
Inserts a substring in a string after a specified character position.
If position = 0, prefixes the substring to the string.
Insert( substring=string, string=string, position=number );
Returns: String
| Argument | Description |
|---|---|
|
substring
string,
required
|
edit
String to insert. |
|
string
string,
required
|
edit
String into which to insert substring. |
|
position
number,
required
|
edit
position in string after which to insert substring. |
Examples
edit str="I love ";
writeDump(insert("lucee",str,7));//I love lucee
//Member function
st="Example";
writeDump(st.insert(" code",7));//Example code
See also
- Strings
- string.insert()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)