Currency.ToText

From Xojo Documentation

Method

Currency.ToText(Optional locale As Locale) As Text

Supported for all project types and targets.

Converts a currency value to a Text value using the specified locale.

Notes

To display the currency symbol, you need to pass in a locale. The currency symbol is displayed before or after the number as specified by the locale settings.

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

Sample Code

Convert Currency to Text:

Var c As Currency = 123.45

Var t As Text
t = c.ToText ' t = "123.45"

In order to display the currency symbol you need to provide a locale:

Var c As Currency = 123.45

Var t As Text
Var locale As New Xojo.Core.Locale("en-US")
t = c.ToText(locale) ' t = $123.45

This code displays a value using French Canadian locale with the currency symbol after the number:

Var c As Currency = 123.45

Var t As Text
Var locale As New Xojo.Core.Locale("fr-CA")
t = c.ToText(locale) ' t = 123,45 $

See Also

Currency.FromText