number = Strings.scanInteger(string); (number, nextIndex) = Strings.scanInteger(string, startIndex=1, unsigned=false, message="");
Function scanInteger scans the string starting at index "startIndex", checks whether the next token is an Integer literal and returns its value as an Integer number, as well as the index directly after the Integer number. An assert is triggered, if the scanned string does not contain an Integer literal with optional leading white space.
function scanInteger extends Modelica.Icons.Function; input String string "String to be scanned"; input Integer startIndex(min = 1) = 1 "Start scanning of string at character startIndex"; input Boolean unsigned = false "= true, if Integer token shall not start with a sign"; input String message = "" "Message used in error message if scan is not successful"; output Integer number "Value of Integer number"; output Integer nextIndex "Index of character after the found number"; end scanInteger;