contains
checks if string contains with pattern.
📝Syntax
tf = contains(str, pattern)
tf = contains(str, pattern,'IgnoreCase', true)
tf = contains(str, pattern,'IgnoreCase', false)
📥Input Arguments
Parameter Description
str a string, string array or cell of strings.
pattern a string to find.
📤Output Arguments
Parameter Description
tf a matrix of logical.
📄Description

contains returns true if str contains pattern.

💡Examples
str = 'To make a mountain out of a molehill';
k = contains (str, 'hill')
k = contains (str, 'molehill')
k = contains (str, 'Hill', 'IgnoreCase', true)

A = {'Nel', 'son'; 'Nelson', 'Modules'}
k = contains(A, 'son')

A = ["Nel", "son"; "Nelson", "Modules"]
k = contains(A, 'son')
🔗See Also
startsWithendsWith
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub