.Modelica.Utilities.Strings.scanReal

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.

Interface

function scanReal
  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 Real token shall not start with a sign";
  input String message = "" "Message used in error message if scan is not successful";
  output Real number "Value of real number";
  output Integer nextIndex "Index of character after the found number";
end scanReal;

Generated at 2024-12-24T19:25:53Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos