File Exchange

image thumbnail

escapeString: convert special characters in a string into their escape sequences

version 1.1 (1.41 KB) by

Escapes special characters (\r, \t, ', ...) in a string and returns the escaped string.

1 Download

Updated

View License

Escapes special characters such as line feeds or tabs in a string and returns the escaped string. Useful for debug purposes.
Receives a string as a parameter and returns the escaped string that will reproduce the string when printing it with sprintf().
If you need to write the escape sequence using sprintf, double escaping by using
sprintf(escapeString(escapeString(str)))
or passing a single escaped string as parameter sprintf('%s',escapeString(str)) will do the trick.
Note that this function is not optimized for speed.

Comments and Ratings (0)

Updates

1.1

Improved the description

MATLAB Release
MATLAB 7.14 (R2012a)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video