scanInteger

Scan for the next Integer number and trigger an assert if not present

Information

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

Syntax

             number = Strings.scanInteger(string);
(number, nextIndex) = Strings.scanInteger(string, startIndex=1,
                                               unsigned=false, message="");

Description

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.

Syntax

(number, nextIndex) = scanInteger(string, startIndex, unsigned, message)

Inputs (4)

string

Type: String

Description: String to be scanned

startIndex

Default Value: 1

Type: Integer

Description: Start scanning of string at character startIndex

unsigned

Default Value: false

Type: Boolean

Description: = true, if Integer token shall not start with a sign

message

Default Value: ""

Type: String

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

Outputs (2)

number

Type: Integer

Description: Value of Integer number

nextIndex

Type: Integer

Description: Index of character after the found number