Is there any function available to Replace any value in a String in vDesigner

Similar to any coding language, Can we use any replace or replace all function in vDeisgner?

3 Likes

Replace function as the name suggests is a function which can be used to replace characters from a string based on a regex.

In Replace function, while using a regex, make sure to used the identifier “~!~”, that is, use this identifier instead of ‘,’ while seperating the parameters.

Below is an example of the complete syntax for the Replace Function:-

Replace(String ~!~ regex ~!~ characters to replace with)

let the String be 1,23,245

let the regex be \d (which simply refers to the digits in the string):

and the characters to replace with: , (comma)

below is the query representing the above parameters:-

Replace(1,23,245 ~!~ \d ~!~ ,)

Result:- ,

this function can be used in copy value and group copy as well. And the String can be fetched from json path as well as from a control.

NOTE:- IF THE THIRD PARAMETER IS LEFT EMPTY THEN THE MATCHED CHARACTERS ARE REPLACED BY AN EMPTY STRING AND THE THIRD PARAMETER IS NOT A REGEX TYPE BUT SIMPLE STRING/CHARACTER

For example:-

Replace(1,23,245 ~!~ \d)

Result:- ,

4 Likes