functionfind
Find first occurrence of a string within another string
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
index = Strings.find(string, searchString);
index = Strings.find(string, searchString, startIndex=1,
caseSensitive=true);
Description
Finds first occurrence of "searchString" within "string" and return the corresponding index. Start search at index "startIndex" (default = 1). If the optional argument "caseSensitive" is false, lower and upper case are ignored for the search. If "searchString" is not found, a value of "0" is returned.
It is intended for ASCII, the case-insensitive count is not guaranteed to work for UTF-8.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | string | String that is analyzed | |
| String | searchString | String that is searched for in string | |
| Integer | startIndex | 1 | Start search at index startIndex |
| Boolean | caseSensitive | true | = false, if lower and upper case are ignored for the search |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | index | Index of the beginning of the first occurrence of 'searchString' within 'string', or zero if not present |