VARKON Version 1.15 1997-10-24


str - Function

Float to string conversion


Description

Converts a float value to a string of characters with optional formatting.

Syntax

str(x, width, precision)

FLOAT x;
INT width;
INT precision;


Principal parameters

x - The float number to convert. Integer numbers are automatically converted to float.


Optional parameters

width - Controls the amount of padding. If width is less than the actual space required no padding
   is performed. If width is larger than the space required the result is padded with blanks.
   The sign of width controls weather padding is done on the left side of the result (+) or the
   right side (-).
precision - Controls the number of decimal places. A value of -1 gives E-notation.


Return value

A STRING of characters.


Examples

str(12345,1,0)    = "12345"
str(12345,10,0) = " 12345"
str(12345,-10,0) = "12345 "
str(12345,-10,2) = "12345.00 "
str(12345,-15,-1) = "1.234500e+04 "
"The value of PI is "+str(pi,1,5) = "The value of PI is 3.14159"

VARKON Homepage Index