Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

string.insert()

Insert a substring into a String at a specified index.

Signature

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

Description

Inserts a substring into the calling String at a provided zero-based offset index position.

Returns a new String. The calling String isn’t changed.

Parameters

Parameter Type Required Description

index

Number

true

Zero-based index position to insert the substring at.

insert

String

true

Substring to insert.

Return value

Type Description

String

String with the inserted substring.

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!