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

endsWith returns true if str ends withpattern.

If str is a categorical array, endsWith tests the category name of each element and returns a logical array of the same size. Undefined elements return false. pattern cannot be categorical.

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

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

A = ["Nel", "son"; "Nelson", "Modules"]
k = endsWith(A, "son")
Pattern matching on the category names of a categorical array.
C = categorical({'winter storm', 'fire', 'Thunder Storm', ''});
tf = endsWith(C, "storm", 'IgnoreCase', true)
🔗See Also
startsWithcontainscategorical
🕔Version History
Version Description
1.0.0 initial version
2.0.0 categorical array accepted as str input.
Edit this page on GitHub