1. Docs
  2. Formulas
  3. Functions

SLICE

Returns 1 or length characters from a piece of text, beginning at the start_index.

Categories: Text

Syntax

SLICE(text, start_index, [length])

Examples

Example 1

Input

1
{
2
"my_action": {
3
"message": "hello world"
4
}
5
}

Formula

SLICE(my_action.message, 6)

Output

"w"

Example 2

Input

1
{
2
"my_action": {
3
"message": "hello world"
4
}
5
}

Formula

SLICE(my_action.message, 6, 5)

Output

"world"

Example 3: If `length` extends past the end of the piece of text, it returns only the remainder of the text:

Input

1
{
2
"my_action": {
3
"message": "hello world"
4
}
5
}

Formula

SLICE(my_action.message, 6, 50)

Output

"world"

Example 4: `start_index` can be specified as a negative number to count back from the end of the piece of text:

Input

1
{
2
"my_action": {
3
"message": "hello world"
4
}
5
}

Formula

SLICE(my_action.message, -5, 5)

Output

"world"

Sample actions

Event Transform
My Action
Event Transform
SLICE
Event Transform
SLICE
Event Transform
SLICE
Event Transform
SLICE

Select an action to inspect

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?