functioncount

Count the number of non-overlapping occurrences of a string

Extends from Modelica.Icons.Function (Icon for functions).

Information

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.

It is intended for ASCII, the case-insensitive count is not guaranteed to work for UTF-8.

Inputs

TypeNameDefaultDescription
StringstringString that is analyzed
StringsearchStringString that is searched for in string
IntegerstartIndex1Start search at index startIndex
BooleancaseSensitivetrue= false, if lower and upper case are ignored for count

Outputs

TypeNameDefaultDescription
IntegerresultNumber of occurrences of 'searchString' in 'string'