@str.slice
Extract a section of a string.
Returns: string
Syntax
Section titled “Syntax”@str.slice(value start end?)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
value |
string |
Input value |
start |
number |
Start index (inclusive) |
[end] |
number |
End index (exclusive) |
Examples
Section titled “Examples”# Slice a prefixset $s "hello world"set $hello @str.slice($s 0 5)
# Slice from offset to endset $s "hello world"set $world @str.slice($s 6)
# Negative index sliceset $s "hello world"set $last3 @str.slice($s -3)