Skip to content

Commit

Permalink
use sprintf to replace unescapejsonstring
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Nov 17, 2023
1 parent ac61d69 commit ee24122
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions loadjson.m
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,7 @@
if (~ischar(str) || isempty(find(str == '\', 1)))
return
end
escapechars = {'\\', '\"', '\/', '\a', '\b', '\f', '\n', '\r', '\t', '\v'};
for i = 1:length(escapechars)
newstr = regexprep(newstr, regexprep(escapechars{i}, '\\', '\\\\'), escapechars{i});
end
newstr = sprintf(str);
newstr = regexprep(newstr, '\\u([0-9A-Fa-f]{4})', '${char(base2dec($1,16))}');

%% -------------------------------------------------------------------------
Expand Down

0 comments on commit ee24122

Please sign in to comment.