varsofstringpattern

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Artificial Intelligence
Introduced first in SolidGeometry 5.4, Creation date: 2023-12-03, Last change: 2025-09-15

finds all the symbolvariables in a string array

Description

waiting for the flight to Bejing CA962.

See Also: , XPSEQS

Example Illustration

 missing image of varsofstringpattern(cond)

Syntax

[var,patt]=varsofstringpattern(cond)

Input Parameter

cond: string array with terms that use $XXX as variable name

Output Parameter

var: string array with variable Name including %char
patt:

Examples


varsofstringpattern(["space on $A", "space on $C", "$A on $B"])




Copyright 2023-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 algorithm is designed to extract variable names from a string array where variables are denoted by a dollar sign ($) followed by a sequence of letters. The function is named varsofstringpattern and is part of the SolidGeometry library.

Input Parameters

Output Results

Algorithm Steps

  1. Define the variable prefix as ss="$".
  2. Create a search pattern searchpat that matches the dollar sign followed by a sequence of letters.
  3. Replace occurrences of the search pattern in cond with the dollar sign, storing the result in patt.
  4. Initialize an empty array var to store extracted variables.
  5. Iterate over each element in cond:
  6. Use unique(var,'stable') to remove duplicate variable names while preserving their order.

Example

Calling varsofstringpattern(["space on $A", "space on $C", "$A on $B"]) will return:

Algorithm explaination created using ChatGPT on 2025-08-18 23:55. (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