Mercurial > hg > octave-nkf
changeset 19649:05eb8eaf63d3
doc: Add puts as a safe alternative to display a string with bare '%' chars (bug #42345).
* io.txi: Add puts as a safe alternative to display a string with bare '%'
chars.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 31 Dec 2014 15:52:06 -0800 |
parents | e5a78897be9e |
children | 728873ccd637 |
files | doc/interpreter/io.txi |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/io.txi +++ b/doc/interpreter/io.txi @@ -621,12 +621,15 @@ Octave will emit an error and stop if it sees such code. When the string variable to be processed cannot be guaranteed to be free of potential format codes it is better to use the two argument form of any of the @code{printf} -functions and set the format string to @code{%s}. +functions and set the format string to @code{%s}. Alternatively, for code +which is not required to be backwards-compatible with @sc{matlab} the +Octave function @code{puts} or @code{disp} can be used. @example @group printf (strvar); # Unsafe if strvar contains format codes printf ("%s", strvar); # Safe +puts (strvar); # Safe @end group @end example