%% Find Text That Starts with Same Characters
% Starting in R2017a, you can create strings using double quotes. Create a string array that contains names. Find the names that start with 'Jean'.

s1 = ["Jacques";
      "Jean";
      "Jeanne";
      "Jean-Luc";
      "Julie"];
s2 = "Jean";

tf = strncmp(s1,s2,4)

%
% tf is 1 for all names whose first four characters are 'Jean'.
% Alternatively, you can use the startsWith function.

tf = startsWith(s1,s2)

% Copyright 2012 The MathWorks, Inc.