Loading [Contrib]/a11y/accessibility-menu.js

contains

Searches for pattern, pat, in the input, src, and returns true if pat is found.

Syntax

R = contains(src, pat)

R = contains(src, pat, 'IgnoreCase', value)

Inputs

src
If src is a cell, all elements of src must be strings.
Type: string | cell
pat
Pattern to search for in src. If pat is a cell, all elements of pat must be strings.
Type: string | cell
'IgnoreCase', value
Optional name-value pair for specifying if case needs to be ignored. Valid options for value are true or false. By default, value is false, indicating that the search is case-sensitive.
Type: logical

Outputs

R
Type: matrix | logical

Examples

String input with case-sensitive (default) search:
R = contains('This is a "contains" example', 'is')
R = 1
Cell array input with multiple patterns and case-sensitive search:
R = contains({'This', 'is', 'a', 'contains', 'example'}, {'THIS', 'a'})
R = [Matrix] 1 x 5
0  0  1  1  1
Cell array input with case-insensitive search:
R = contains({'This', 'is', 'a', 'contains', 'example'}, {'THIS', 'a'}, 'IgnoreCase', true)
R = [Matrix] 1 x 5
1  0  1  1  1