REPLACE
replaces a segment of a string with another string.
Function category: Text​
REPLACE(arg1, arg2, arg3, arg4)
Arguments | Description |
| String to be segmented. |
| Position in the string at which to begin slicing. |
| Number of characters to slice from the string. |
| String to replace the substring delineated by |
arg2
is inclusive, meaning the character at the specified position will be included in the segment.
Let's say we're given a response with an id value.
{"data":{"ids":{"id_1": "1anb4amca051"}}}
If we want to replace the first four digits of the id with our another string, use the following function.
# Replace specified digits with a strongREPLACE(data.ids.id_1, 1, 4, "custom-id-")​# Returns "custom-id-4amca051"