Navigation

Operators and Keywords

Function List:

C++ API

: undo_string_escapes (s)

Convert special characters in strings back to their escaped forms.

For example, the expression

bell = "\a";

assigns the value of the alert character (control-g, ASCII code 7) to the string variable bell. If this string is printed, the system will ring the terminal bell (if it is possible). This is normally the desired outcome. However, sometimes it is useful to be able to print the original representation of the string, with the special characters replaced by their escape sequences. For example,

octave:13> undo_string_escapes (bell)
ans = \a

replaces the unprintable alert character with its printable representation.

See also: do_string_escapes.

Package: octave