Double.ToString

From Xojo Documentation

Method

Double.ToString(Optional locale As Locale) As String

New in 2019r2

Supported for all project types and targets.

Converts a Double value to a String value with an optional locale.


Method

Double.ToString(locale As Locale, format As String) As String

New in 2019r2

Supported for all project types and targets.

Converts a Double value to a String value using the supplied locale and format.

Notes

If no locale is specified, then Locale.Raw is used.

Refer to Unicode Number Format Patterns for a list of formats.

Sample Code

Convert Double values to Text:

Var d As Double = 123.45

Var s As String
s = d.ToString // s = "123.45"

Var n As Double = 1239.4567
Var s1 As String = n.ToString(Locale.Current, "#,###.##") // s1 = 1,239.46

Var n2 As Double = 12
Var s2 As String = n.ToString(Locale.Current, "#.00") // s2 = 12.00