Search code examples
escapingdynamics-business-centraldynamics-albusinesscentral

How to escape a character in a string in business central AL


I keep coming across situations where i need to escape a character such as a quote. I never been able to figure out how to do this since a simple Message('test \' test'); doesn't work.

Every time i need to figure out a workaround, and its starting to bother me. Is there a way to do this or is it simply impossible?


Solution

  • It's a double quote mark in AL:

    Message('test '' test');
    

    Two consequent quote marks are interpreted as a single escaped quote. If you have a longer sequence, the same rule applies. Message('''''Test'''''); will display the text with two quote marks on each side.