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.slice()
Get the substring between two indexes of a String.
Description
Extracts the substring between provided two zero-based offset indexes of the calling String.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
start |
true |
Starting index of the substring to extract (inclusive). The index is a zero-based offset, counted from the left. If this start index is greater than or equal to the length of the String, the method returns an empty String. |
|
end |
true |
Ending index of the substring to extract (exclusive). The index is a zero-based offset, counted from the left. If this end index is less than the start index, the method returns an empty String. |
Examples
Get the subString from index 9 up to, but not including, 15:
"HTTP/1.1 200 OK".slice(9, 15)
"200 OK"
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!