count

Count the number of non-overlapping occurrences of a string

Information

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

Syntax

Strings.count(string, searchString)
Strings.count(string, searchString, startIndex=1,
                     caseSensitive=true)

Description

Returns the number of non-overlapping occurrences of string "searchString" in "string". The search is started at index "startIndex" (default = 1). If the optional argument "caseSensitive" is false, for the counting it does not matter whether a letter is upper or lower case.

Syntax

result = count(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 count

Outputs (1)

result

Type: Integer

Description: Number of occurrences of 'searchString' in 'string'