%% Insert Substring After Position
% Create string arrays and specify positions to insert substrings.
% Starting in R2017a, you can create strings using double quotes.

str = "James Maxwell"

%
% Insert a substring after the fifth character.

newStr = insertAfter(str,5," Clerk")

%
% Insert substrings into each element of a string array. When you specify different positions with numeric arrays, they must be the same size as the input string array.

str = ["James Maxwell";"Carl Gauss"]
newStr = insertAfter(str,[5;4],[" Clerk";" Friedrich"])

% Copyright 2012 The MathWorks, Inc.