Skip to main content

$$substring

Gets a slice of a string by indices (negative begin index will slice from the end)

Usage​

{ 
"$$substring": /* String to slice */,
"begin": /* integer */,
"end": /* integer */
}
"$$substring(<begin>,[end]):{input}"

Returns​

string

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
PrimarystringYesString to slice
beginintegerYesIndex of first character to slice from (if negative, counts from the end of the string)
endintegernullIndex of last character to slice to (if negative, counts from the end of the string)

Examples​

Input

Definition

Output

"hello-world"
"$$substring:$"
"hello-world"
"hello-world"
"$$substring():$"
"hello-world"
"hello-world"
"$$substring(5):$"
"-world"
"hello-world"
"$$substring(5,8):$"
"-wo"
"hello-world"
"$$substring(-5):$"
"world"
"hello-world"
"$$substring(5,-5):$"
"-"
"hello-world"
"$$substring(-5,-1):$"
"worl"
12345678
"$$substring(-5,-1):$"
"4567"