This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
MID
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
MID
returns a segment of a string.
MID(arg1, arg2, arg3)
-
arg1
is a string to be segmented -
arg2
is the position to begin slicing the string at -
arg3
is the number of characters to slice from the string
Let's say we're given a response with an id:
{
"data":{
"ids":{
"id_1": "1anb4amca051"
}
}
}
If we are only interested in the middle 6 digits of the id, we can get them with MID
:
MID(data.ids.id_1, 4, 6)
This would return b4amca
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.