by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Text/Strs/Chars/Links
Introduced first in SolidGeometry 4.7, Creation date: 2019-06-15, Last change: 2025-09-14
See Also: , stldir
ind=containscell(A,sstr,[IgnoreCase])
A: | Cell List of Strings | |
sstr: | string to search | |
IgnoreCase: | if true; case is ignored |
ind: | index list |
a={'xedr','ere','tyui'}', containscell(a,'e')
This function, containscell, is designed to search for a specific string segment within a cell array of strings. It is part of the SG-Library and was introduced in SolidGeometry 4.7. The function is now considered obsolete as of November 4, 2021, and users are encouraged to use the built-in contains function instead.
A.true, the search will ignore case differences. This parameter is retrieved using the getfuncparams function, with a default value of true.A. Each element of ind is true if the corresponding element in A contains the string segment sstr, and false otherwise.IgnoreCase parameter using getfuncparams, with a default value of true.A using numel.ind to be the same size as A, with all elements set to false.A using a for loop:IgnoreCase is true, use the contains function with the 'IgnoreCase' option set to true to check if the element contains sstr.IgnoreCase is false, use the contains function without the 'IgnoreCase' option.ind to true if the string segment is found.The function is straightforward and relies on the built-in contains function to perform the actual string search, with the added flexibility of case sensitivity control.