scanDelimiter

Scan for the next delimiter and trigger an assert if not present

Information

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

Syntax

             delimiter = Strings.scanDelimiter(string);
(delimiter, nextIndex) = Strings.scanDelimiter(string, startIndex=1,
                                 requiredDelimiters={","}, message="");

Description

Function scanDelimiter scans the string starting at index "startIndex", checks whether the next token is a delimiter string and returns its value as a string, as well as the index directly after the delimiter. An assert is triggered, if the scanned string does not contain a delimiter out of the list of requiredDelimiters. Input argument requiredDelimiters is a vector of strings. The elements may have any length, including length 0. If an element of the requiredDelimiters is zero, white space is treated as delimiter. The function returns delimiter="" and nextIndex is the index of the first non white space character.

Syntax

(delimiter, nextIndex) = scanDelimiter(string, startIndex, requiredDelimiters, message)

Inputs (4)

string

Type: String

Description: String to be scanned

startIndex

Default Value: 1

Type: Integer

Description: Start scanning of delimiters at character startIndex

requiredDelimiters

Default Value: {","}

Type: String[:]

Description: Delimiters that are searched

message

Default Value: ""

Type: String

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

Outputs (2)

delimiter

Type: String

Description: Found delimiter

nextIndex

Type: Integer

Description: Index of character after the found delimiter