String operations
You can use the following helper methods to join, split, replace or perform substring operations on string values.
Last updated
You can use the following helper methods to join, split, replace or perform substring operations on string values.
Last updated
Description
Example
Result
String concatenate
{{ concat 'bee' 'hive' }}
beehive
Convert a delimited string into an array
{{ split 'bee,hive' ',' }}
[]string{“bee”, “hive”}
Replace all occurrences of the old value with the new
value in the target string
{{ replace (Request.Body 'jsonpath' '$.text')
'be' 'mock' }}
(where Request.Body has the value of
{"text":"to be or not to be"}
to mock or not to mock
Return a substring of a string
{{substring 'thisisalongstring' 7 11}}
long
Return the length of a string
{{length 'thisisaverylongstring'}}
21
Return the rightmost characters of a string
{{rightmostCharacters 'thisisalongstring' 3}}
ing