%% Enforce Case Insensitivity
% Use caseInsensitivePattern to enforce case insensitivity in case-sensitive functions.
% Create a string of lowercase letters. Create a pattern that matches uppercase "ABC". When used in a case-sensitive function, pat does not match txt.

txt = "abc";
pat = "ABC";
contains(txt,pat,'IgnoreCase',false)

% Use caseInsensitivePattern to enforce case insensitivity in matching for pat even when used as the input for a case-sensitive function.

pat = caseInsensitivePattern(pat);
contains(txt,pat,'IgnoreCase',false)

% Copyright 2020 The MathWorks, Inc.