Skip to content

Commit

Permalink
Clarify rules about allowed combination of String named arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 17, 2022
1 parent 8b9376a commit b27a186
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions chapters/operatorsandexpressions.tex
Expand Up @@ -501,21 +501,24 @@ \subsection{Numeric Functions and Conversion Functions}\label{numeric-functions-
\end{lstlisting}\end{synopsis}
\begin{semantics}
Convert a scalar non-\lstinline!String! expression to a \lstinline!String! representation.
The first argument may be a \lstinline!Boolean! $b$, an \lstinline!Integer! $i$, a \lstinline!Real! $r$ or an enumeration value $e$ (\cref{type-conversion-of-enumeration-values-to-string-or-integer}).
The other arguments must use named arguments.
For \lstinline!Real! expressions the output shall be according to the Modelica grammar.

The optional \lstinline!<options>! are:
The first argument may be a \lstinline!Boolean! $b$, an \lstinline!Integer! $i$, a \lstinline!Real! $r$, or an enumeration value $e$ (\cref{type-conversion-of-enumeration-values-to-string-or-integer}).
The other arguments can only be passed as named arguments, and the recognized ones are:
\begin{itemize}
\item
\lstinline!String format!: ANSI-C style format string, see below.
Only allowed for formatting of a \lstinline!Real! value, and must not be combined with other named arguments.
\item
\lstinline!Integer minimumLength = 0!: Minimum length of the resulting string.
If necessary, the blank character is used to fill up unused space.
\item
\lstinline!Boolean leftJustified = true!: If true, the converted result is left justified in the string; if false it is right justified in the string.
\item
\lstinline!Integer significantDigits = 6!: Number of significant digits in the result string.
Required when formatting a \lstinline!Real! value and \lstinline!format! is not provided.
\end{itemize}

For \lstinline!Real! expressions the output shall be according to the Modelica grammar.

\begin{nonnormative}
Examples of \lstinline!Real! values formatted with 6 significant digits: \emph{12.3456}, \emph{0.0123456}, \emph{12345600}, \emph{1.23456E-10}.
\end{nonnormative}
Expand Down

0 comments on commit b27a186

Please sign in to comment.