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.
- pat
- Pattern to search for in src. If pat is a cell, all elements of pat must be strings.
- '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.
Outputs
- R
- Type: matrix | logical
Examples
R = contains('This is a "contains" example', 'is')
R = 1
R = contains({'This', 'is', 'a', 'contains', 'example'}, {'THIS', 'a'})
R = [Matrix] 1 x 5
0 0 1 1 1
R = contains({'This', 'is', 'a', 'contains', 'example'}, {'THIS', 'a'}, 'IgnoreCase', true)
R = [Matrix] 1 x 5
1 0 1 1 1