The Fauna service will be ending on May 30, 2025.

For more information on the service wind down, see our announcement and the Fauna Service End-of-Life FAQ.

string.splitAt()

Split a String at a provided index.

Signature

splitAt(index: Number) => [String, String]

Description

Splits the calling String at a zero-based offset index.

The calling String isn’t changed.

Parameters

Parameter Type Required Description

index

Number

true

Zero-based offset index to split the calling String at.

Return value

Type Description

Array<String>

Array of Strings resulting from the split.

Examples

'foobar'.splitAt(3)
[
  "foo",
  "bar"
]
\