Skip to main content
Skip table of contents

f$FtoS (f$ZahlZuText)


f$FtoS (f$ZahlZuText)

Convert a number into a string. The ’.’ is used as decimal separator. If no format is specified, integer values will be produced without decimal places and other values with six decimal places.

If text is entered instead of a number, a syntax error is not reported and the text is returned.

The format has the following syntax:

%[flags] [width] [.precision] [{h | l | I64 | L}]type

flags:

0 : leading zeros are entered up to the specified length.

+ : + or – is always written before the number

width: minimum number of characters to be produced

precision: numerical precision This corresponds to the number of decimal places when using floating values.

type: type of number:

c : individual character

d : integer

f : decimal

x : output as hexadecimal string (lower case)

X : output as hexadecimal string (upper case)

Syntax:

Text = f$FtoS( Number[, Formattext] )

 

Argument

Type

Meaning

 

Number

Decimal

Number to be converted

 

Formattext

(Optional)

String

Instruction text according to which the output is formatted
'%<number of places>.<number of decimal places>lf'
If the number of places is given as 0, the current length matching the number is used. If, however, an actual number of places is entered, a 0 can be placed in front of the number to get text with leading zeros.
Standard case with integers: '%0.0lf' oder '%d'
Standard case with floating numbers: '%0.2lf' (for two decimal places)
Converting a character: '%c' (see below)

Result:

String

Number as formatted text

Example:

Number as formatted textàText = '12'

Text = f$FtoS( 89.358, '%0.2lf' ) → Text = '89.36'

Text = f$FtoS( 26, '%04.0lf' ) → Text = '0026'

With the format text ’%c’ you can enter a special character into a text using ASCII number code, e.g. a line break can be made in this way:

Break = f$FtoS(13,’%c’)


The resulting string then consists of exactly one character - the line break.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.