delimiter = Strings.scanDelimiter(string); (delimiter, nextIndex) = Strings.scanDelimiter(string, startIndex=1, requiredDelimiters={","}, message="");
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.
function scanDelimiter extends Modelica.Icons.Function; input String string "String to be scanned"; input Integer startIndex(min = 1) = 1 "Start scanning of delimiters at character startIndex"; input String requiredDelimiters[:] = {","} "Delimiters that are searched"; input String message = "" "Message used in error message if scan is not successful"; output String delimiter "Found delimiter"; output Integer nextIndex "Index of character after the found delimiter"; end scanDelimiter;