functionscanDelimiter

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

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

Information

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.

Inputs

TypeNameDefaultDescription
StringstringString to be scanned
IntegerstartIndex1Start scanning of delimiters at character startIndex
String[:]requiredDelimiters{","}Delimiters that are searched
Stringmessage""Message used in error message if scan is not successful

Outputs

TypeNameDefaultDescription
StringdelimiterFound delimiter
IntegernextIndexIndex of character after the found delimiter

Contents

NameDescription
concatenateprotectedConcatenate strings together