Single.ToString

From Xojo Documentation

Method

Single.ToString(Optional locale As Locale) As Single

Supported for all project types and targets.

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


Method

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

Supported for all project types and targets.

Converts a Single 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 Singles values to String:

Var s As Single = 123.45
MessageBox(d.ToString)

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

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