string.slice()
Description
The slice()
method extracts the subString between the
character offsets from, inclusive, and until, exclusive.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
from |
Yes |
Starting index of the subString to extract, inclusive, and counted from the left. If from is greater than or equal to the length of the String, the method returns an empty String. |
|
until |
Yes |
Ending index of the subString to extract, exclusive, and the index is counted from the left. If until is less than from, the method returns an empty String. |
Return value
Type | Description |
---|---|
Substring of characters from the calling string, between the offsets from, inclusive, and until, exclusive. |
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!