www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/InsertTextAfterSubstringExample.m

    %% Insert Text After Substring
% Create string arrays and insert text after substrings.
%
% Create a string. Insert text that after the substring
% |quick|.
str = string('The quick fox')

%%
newStr = insertAfter(str,'quick',' brown')

%%
% Insert substrings into each element of a string array. When you specify 
% different substrings as positions, they must be contained
% in a string array or a cell array that is the same size as |str|.
str = string({'The quick fox jumps';'over the dog'})

%%
newStr = insertAfter(str,{'quick';'the'},{' brown';' lazy'})