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
REPLACE
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
REPLACE
replaces a segment of a string with another string.
REPLACE(arg1, arg2, arg3, arg4)
-
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 -
arg4
is string to replace the substring delineated byarg3
andarg4
Let's say we're given a response with an id:
{
"data":{
"ids":{
"id_1": "1anb4amca051"
}
}
}
If we replace the first four digits of the id with our own string, we can do so using REPLACE
:
REPLACE(data.ids.id_1, 1, 4, "custom-id-")
This will return "custom-id-4amca051"
The second argument is inclusive, meaning the character at the specified position will be included in the segment.