Contents | Prev | Next
7.4.56 The str procedure
Description
The str procedure converts an integral or real value into a string and stores
this string into a string variable.
Parameters
- The first parameter specifies up to three items:
- The first item is an expression of
integral type or
real type and is the value to be converted into a string.
- The second item is optional, and if supplied is the minimum width of the string the
value is converted to. If this item is not supplied then the minimum width of the string
depends on the type of the value being converted. If an integral value is being converted then
the minumum width of the string is eigth (8) characters, and if a real value is being converted
then the minimum with of the string is nine (9) characters. NOTE: The string is
padded on the left with spaces, if it is shorter than the minimum width.
- The third item is optional, if a real value is being converted, and is the number of
digits that follow the decimal point in the converted string (the real value is converted
into fixed point representation). If third item is not supplied, and a real value is being
converted, then the real value is converted into a exponential representation.
- The second parameter is a reference to the
string variable that will store the converted string
value.
Example
str(1034, s); will store ' 1034' in s
str(1034:1, s); will store '1034' in s
str(1034:5, s); will store ' 1034' in s
str(7893.678, s); will store ' 7.89E+03' in s
str(7893.678:8, s); will store '7.89E+03' in s
str(7893.678:8:3, s); will store '7893.678' in s
Portability
Operating Systems: All
Standard Pascal: No
Contents | Prev | Next