How to escape Double quotes (“) in Power apps canvas apps

Welcome to my blog. This one is going to be a real short one and a useful one it.

In this blog I will discuss on how to escape a double quotes (“) from a string in canvas apps.

Let’s assume we want to set the following string to the Text of label control

This is the most common phrase - "A quick brown fox jumps over the lazy dog". Even more than the phrase - "Lorem ipsum"

Let’s try to set the Text property of the label to this value.

Escape double quotes (") in Power apps canvas apps

Quite obvious you need to escape the double quotes. Whenever we think of escaping the double quote, we usually use the backslash character (“\”).

Escape double quotes (") in Power apps canvas apps

As we can see, the backslash does not work here. So let’s see how we can escape the double quotes.

Just like on many other occasions, we need to use the Char function. To escape double quotes, we need to use Char(34) function.

Below is the modified version of the string which will work in canvas apps.

$"This is the most common phrase - {Char(34)}A quick brown fox jumps over the lazy dog{Char(34)}. Even more than the phrase - {Char(34)}Lorem ipsum{Char(34)}"
Escape double quotes (") in Power apps canvas apps

If you are wondering about the $ syntax and why we are using that instead of the regular & to append text, you can follow this blog link.

Hope this helped. You will also like the below posts

Debajit Dutta
Business Solutions MVP