Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Str Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Arguments
number Integer or real expression
<format> Optional; depends on the type of the expression
destination String variable to receive the numeric string
Description
The Str procedure takes an integer or real value and puts a string
representation of that number into a string variable.
The format argument is optional. It controls the format of the
conversion. The formatting specification is the same as that
passed to the Write and Writeln procedures for numeric output.
The format is
number [ : width [ : places ] ]
The width and places arguments are positive integer
expressions that control the conversion format.
The width argument gives the minimum field width. The number
is right justified within the field if it fits. For an
integer, if the number does not fit or if width is omitted,
the number takes as much space as needed. For a real number,
if width is less than 8, the value is ignored and a field
width of 8 is used. If width is omitted, a width of 23 is
assumed. The field width includes the decimal point and any
places after the decimal. A negative width is ignored.
The places argument gives the number of places to the right of
the decimal. This parameter applies only to real arguments
when width is specified. If places is greater than 18 or is
negative, 18 decimal places are used. Omit places or give a
negative value to write in scientific (engineering) notation.
Specify 0 places to round a real to the nearest whole number.
The output string for an integer has the form:
[-] <digits>
The output string for a real number has the form:
[-] <digits> [.<digits>] [ {E│e} [+│-] <digits> ]
Numeric output in hexadecimal format is not possible.