WOLFRAM SYSTEM MODELER

scanReal

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

Wolfram Language

In[1]:=
SystemModel["Modelica.Utilities.Strings.scanReal"]
Out[1]:=

Information

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

Syntax

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

Description

The first form, "scanReal(string)", scans "string" for a Real number with leading white space and returns the value.

The second form, "scanReal(string,startIndex,unsigned)", scans the string starting at index "startIndex", checks whether the next token is a Real literal and returns its value as a Real number, as well as the index directly after the Real number. If the optional argument "unsigned" is true, the real number shall not have a leading "+" or "-" sign.

If the required Real number with leading white space is not present in "string", an assert is triggered.

Syntax

(number, nextIndex) = scanReal(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 Real 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: Real

Description: Value of real number

nextIndex

Type: Integer

Description: Index of character after the found number