String interpolation: Standardized processing of escape sequences (v.22, breaking change)

Starting from v.22 SP10 the handling of escape sequences in string interpolation is now standardized.

Each "\" (backslash) character starts an escape sequence the interpretation of which is determined by the next character.

The most typical example for an escape sequence is when you need to put a NEW LINE in your interpolated string. You can't write an ASCII code directly, so a specific escape sequence is the way to go.

\r\n

Or the following string,

"Hello,\r\nworld!"

will be interpreted like this:

"Hello,
world!"

A list of all supported series on ERP.net can be found here,

https://docs.erp.net/tech/advanced/string-interpolation/escape-sequences.html#supported-escape-sequences

Does this change affect me?

It does if your interpolated strings contain single backslashes "\".

The most common case is if you use Windows paths. That's because they contain backslashes.

What to do if this change affects me?

Depending on what exactly is contained in your affected interpolated strings, it's usually enough to just double up the contained backslashes.

E.g., in case of Windows path:

this,

C:\MyFolder\file.txt

should become this,

C:\\MyFolder\\file.txt

---

More information is available in our official documentation:

https://docs.erp.net/tech/advanced/string-interpolation/index.html

https://docs.erp.net/tech/advanced/string-interpolation/escape-sequences.html

https://en.wikipedia.org/wiki/Escape_sequence

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk