StrD()

Syntax

Result$ = StrD(Value.d [, NbDecimal])
Description
Converts a double number into a string.

Parameters

Value.d The value to convert.
NbDecimal (optional) The maximum number of decimal places for the converted number. If omitted, it will be set to 10 decimal places, with removing the trailing zeros. The number will be rounded, if 'NbDecimal' is smaller than existing decimal places of 'Value.d'.

Return value

A string holding the converted value.

Remarks

Signed integer numbers have to be converted with Str() and unsigned numbers with StrU(). It is possible to omit this command when concatenating string and double, it will then use the default behaviour of StrD().

Example

  Value.d = 10.54
  Debug "Result: " + StrD(Value)     ; we do not use the 2nd parameter, so we get a float number rounded to 10 decimal places
  Debug "Result: " + Value           ; same as previous line
  Debug "Result: " + StrD(Value, 2)  ; we want a result with two decimal places, no rounding needed as we have only two
  Debug "Result: " + StrD(Value, 0)  ; we want a result with no decimal places, so the value is rounded

See Also

StrF(), Str(), StrU(), FormatNumber()

Supported OS

All

<- Str() - String Index - StrF() ->