skip to Main Content

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

2

Answers


  1. 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 value hello'world and replace_char with the value '.

    enter image description here

    • I used a set variable activity to store the output of the replace() function (for demonstration) into variable named output (String). Now, I modified the value as:
    @replace(pipeline().parameters.text,pipeline().parameters.replace_char,'"')
    

    enter image description here

    • This successfully helps in replacing a single quote with double quote character.

    enter image description here

    NOTE: The in the output variable value indicates that the " is to be considered as a character inside the string value.

    Login or Signup to reply.
  2. Use two single quotes to escape a ‘ character in string functions.

    For example, expression @concat('Baba', '''s ', 'book store') will return below result.

    Baba's book store
    

    https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#escaping-single-quote-character

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search