Tag Archives: Newline

Adding an escaped linebreak in Javascript

If your working in Javascripting what happens when you try to add a line break like \br\ to your code?

Most parsers will choke on it as the backslash is also used as a string terminator.

Here’s how I did it:

var linebreak = String.fromCharCode(92) + ‘.br’ + String.fromCharCode(92);
if (seg[‘OBX.5’][‘OBX.5.1’].toString() == ”) {

    seg[‘OBX.5’][‘OBX.5.1’] = linebreak;

}

Fairly clean solution.

 

Leave a comment

Filed under Mirth Integration Engine, Tips and Tricks