containscell

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

finds a string segment into a cell list of strings



See Also: , stldir

Example Illustration

 missing image of containscell(A,sstr,IgnoreCase)

Syntax

ind=containscell(A,sstr,[IgnoreCase])

Input Parameter

A: Cell List of Strings
sstr: string to search
IgnoreCase: if true; case is ignored

Output Parameter

ind: index list

Examples


a={'xedr','ere','tyui'}', containscell(a,'e')




Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

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.

Input Parameters

Output Results

Algorithm Steps

  1. Retrieve the IgnoreCase parameter using getfuncparams, with a default value of true.
  2. Determine the number of elements in the cell array A using numel.
  3. Initialize the output logical array ind to be the same size as A, with all elements set to false.
  4. Iterate over each element of the cell array A using a for loop:

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.

Algorithm explaination created using ChatGPT on 2025-08-19 00:45. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21