%% Test End of String Against Multiple Extensions
% Create a string array that contains file names. Determine which file names end with the .docx, .xlsx, or .gz extensions.
% Starting in R2017a, you can create strings using double quotes.

str = ["data.tar.gz","mycode.m","outputs.xlsx","results.pptx"]

%

pat = [".docx",".xlsx",".gz"];
TF = endsWith(str,pat)

%
% Display the file names that end with .docx, .xlsx, or .gz. Index back into str using TF.

str(TF)

% Copyright 2012 The MathWorks, Inc.