string.insert()

Insert a String at a given location.

Signature

insert(index: Number, insert: String) => String

Description

The insert() method inserts insert at index in the source string.

The source string isn’t changed.

Parameters

Parameter Type Required Description

index

Number

Yes

Location to insert insert.

insert

String

Yes

String to insert at index in the source string.

Return value

Type Description

String

String with insert inserted at index in the source string.

Examples

'foo'.insert(0, 'bar')
"barfoo"

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!