splitAt()

Split a String at the given index.

Signature

splitAt(index: Number): Array

Description

The splitAt() method splits the input string at index and returns a list of strings.

The input string isn’t changed.

Parameters

Parameter Type Required Description

index

Number

Yes

Location in input string to split the string.

Return value

Type Description

Array

Array of strings.

Examples

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

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!