MID
returns a segment of a string.
Function category: Text​
MID(arg1, arg2, arg3)
Arguments | Description |
| String to be segmented. |
| Position in string at which slicing should begin. |
| 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.
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 digitsMID(data.ids.id_1, 4, 6)​# Returns b4amca