I am trying to replace single quote in a string with double quote using replace function with data factory expressions.
For example, replace single quote in the following string
hello'world ---> hello''world
@replace(pipeline().parameters.tst,''','''')
The above code is not working. Need help in fixing the code
CodePudding user response:
You can declare a new parameter with the value '
(single quote). You can look at the following demonstration for reference.
- I have taken 2 parameters,
text
with the valuehello'world
andreplace_char
with the value'
.
- I used a
set variable
activity to store the output of thereplace()
function (for demonstration) into variable namedoutput
(String). Now, I modified the value as:
@replace(pipeline().parameters.text,pipeline().parameters.replace_char,'"')
- This successfully helps in replacing a single quote with double quote character.
NOTE: The \
in the output
variable value indicates that the "
is to be considered as a character inside the string value.