RIGHT

RIGHT returns the rightmost segment of a string, as specified by a segment position argument.

Function category: Text

To get characters from the left side of a string, use LEFT‚Äč

Unlike LEFT, the segment position argument for RIGHT is counted from right to left, as opposed to left to right.

Syntax

RIGHT(arg1, arg2)

Arguments

Descriptions

arg1

String to be segmented.

arg2

Optional. Point from the right at which to segment the strings (defaults to 1)

Examples

Example 1: Extract last 5 digits in a string.

Let's say we're given a response with an id:

{
"data":{
"ids":{
"id_1": "1anb4amca051"
}
}
}

If we are only interested in the last 5 digits of the id, we can get them with RIGHT:

RIGHT(data.ids.id_1, 5)

This returns the following:

ca051