find

Find first occurrence of a string within another string

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

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.

Syntax

index = find(string, searchString, startIndex, caseSensitive)

Inputs (4)

string

Type: String

Description: String that is analyzed

searchString

Type: String

Description: String that is searched for in string

startIndex

Default Value: 1

Type: Integer

Description: Start search at index startIndex

caseSensitive

Default Value: true

Type: Boolean

Description: = false, if lower and upper case are ignored for the search

Outputs (1)

index

Type: Integer

Description: Index of the beginning of the first occurrence of 'searchString' within 'string', or zero if not present