Description: Function for returning a String representation of numbers.
To return the empty String
, use no arguments:
result = String()
For x
a scalar or array of any rank and of type character
:
result = String(x)
This is for character
to String
conversion.
For x
a scalar or array of any rank and of type integer
:
result = String(x [, fmt])
fmt
is optional
, may be one of INT_FMTS
For x
a scalar or array of any rank and of type real
:
result = String(x [, locale, fmt, decimals])
locale
is optional
, may be one of LOCALES
fmt
is optional
, may be one of REAL_FMTS
decimals
is optional
and of type integer
For x
a scalar or array of any rank and of type complex
:
result = String(x [, locale, fmt, decimals, im])
locale
is optional
, may be one of LOCALES
fmt
is optional
, may be one of REAL_FMTS
decimals
is optional
and of type integer
im
is optional
and of type character(len=*)
Note
Unlike str, which takes scalar arguments only and
returns a character
, String
operates elementally and returns a
String.
Integer formats (default is "i"
):
INT_FMTS = [ "i", "z" ]
Real formats (default is "e"
):
REAL_FMTS = [ "e", "f", "z" ]
Locales (default is "US"
):
LOCALES = [ "US", "EU" ]
Decimals: decimals
specifies the number of digits on the rhs of the
radix point, with a default determined internally based on the
text format and precision.
Imaginary unit: im
specifies the form of a complex number. By
default, complex
numbers will be written as ordered pairs, e.g.
(2.45,3.45)
. If im
is specified, then the number will be written as
a sum with the specified imaginary unit, e.g. 2.45+3.45j
for im="j"
or 2.45+3.45*1i
for im="*1i"
.