fabien van mook

all packages "fvm-*"

package "fvm-charvec"

function file "edit_double_quotes.m"

Function edit_double_quotes(fns)
         edit_double_quotes(fns,d)

edits (rewrites) m-files given in cell-array of strings,
fns, by:
-- replacing double quotes by single quotes at string
   literals without backslashes. E.g. the code:
     s = "text";
   is changed into:
     s = 'text';
-- inserting 'sprintf(''%s'',' and ')' before and after
   string literals with backslashes. E.g. the code:
     s = "text\ntext";
   is changed into:
     s = sprintf('%s',"text\ntext");

   This works as long as the sprintf() function returns a
   character vector, _because_ the _template_ is given as
   a character vector, even if the second input argument
   may well be given as a double-quote string.

If the second input argument is not given, or if it is
empty, the original m-file, ending by '.m', is renamed,
and its new name will end with '_yyyymmdd_hhmmss.m'. The
resulting m-file will then get the name of the original
m-file.

If the second input argument is a non-empty string, the
original m-file is not renamed, and the resulting m-file
with the name of the original m-file is written into the
directory.


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-charvec" under GNU GPLv3+