functionscanReal
Scan for the next Real number and trigger an assert if not present
Extends from Modelica.Icons.Function (Icon for functions).
Information
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.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | string | String to be scanned | |
| Integer | startIndex | 1 | Start scanning of string at character startIndex |
| Boolean | unsigned | false | = true, if Real token shall not start with a sign |
| String | message | "" | Message used in error message if scan is not successful |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | number | Value of real number | |
| Integer | nextIndex | Index of character after the found number |