MID

MID returns a segment of a string.

Function category: Text

Syntax

MID(arg1, arg2, arg3)

Arguments

Description

arg1

String to be segmented.

arg2

Position in string at which slicing should begin.

arg3

Number of characters to slice from the string.

The second argument is inclusive, meaning the character at the specified position will be included in the segment.

Additionally, if the number of characters from the starting position (arg2) is less than the number specified in arg3, all available characters after the starting position will be returned.

Example

Let's say we're given the following response that includes an id.

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

If we are only interested in the middle 6 digits of the id, use the following function.

# Return the middle 6 digits
MID(data.ids.id_1, 4, 6)
‚Äč
# Returns b4amca