MATLAB Examples

Several Examples Using unescapeJavaScriptString

s = 'Hi everybody!';
disp(s)
disp(unescapeJavaScriptString(s))
Hi everybody!
Hi everybody!
s = 'Handle escaped \"quotes\".';
disp(s)
disp(unescapeJavaScriptString(s))
Handle escaped \"quotes\".
Handle escaped "quotes".
s = 'Deal\nwith\nnewlines.';
disp(s)
disp(unescapeJavaScriptString(s))
Deal\nwith\nnewlines.
Deal
with
newlines.
s = 'And show \\escaped \\backslashes.';
disp(s)
disp(unescapeJavaScriptString(s))
And show \\escaped \\backslashes.
And show \escaped \backslashes.
s = 'Latin-1 can be escaped as \157\143\164\141\154.';
disp(s)
disp(unescapeJavaScriptString(s))
Latin-1 can be escaped as \157\143\164\141\154.
Latin-1 can be escaped as octal.
s = 'Latin-1 can also be escaped as \x68\x65\x78.';
disp(s)
disp(unescapeJavaScriptString(s))
Latin-1 can also be escaped as \x68\x65\x78.
Latin-1 can also be escaped as hex.
s = 'Unicode uses four hexadecimal digits, e.g. "\u00A9".';
disp(s)
disp(unescapeJavaScriptString(s))
Unicode uses four hexadecimal digits, e.g. "\u00A9".
Unicode uses four hexadecimal digits, e.g. "©".