scanString

Scan for the next Modelica string and trigger an assert if not present

Information

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

Syntax

             string2 = Strings.scanString(string);
(string2, nextIndex) = Strings.scanString(string, startIndex=1, message="");

Description

Function scanString scans the string starting at index "startIndex", checks whether the next token is a String literal and returns its value as a String, as well as the index directly after the String. An assert is triggered, if the scanned string does not contain a String literal with optional leading white space.

Syntax

(result, nextIndex) = scanString(string, startIndex, message)

Inputs (3)

string

Type: String

Description: String to be scanned

startIndex

Default Value: 1

Type: Integer

Description: Start scanning of string at character startIndex

message

Default Value: ""

Type: String

Description: Message used in error message if scan is not successful

Outputs (2)

result

Type: String

Description: Value of string

nextIndex

Type: Integer

Description: Index of character after the found string