Currency.FromText

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Shared Method

Currency.FromText(theText As Text, Optional locale As Xojo.Core.Locale) As Currency

Supported for all project types and targets.

Converts a Text value containing a number that can be represented as a currency to a Currency value.

Notes

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

Sample Code

Convert values to the Currency type:

Var userValue As Text
userValue = "123.45"

Var c As Currency
c = Currency.FromText(userValue)

Var locale As New Xojo.Core.Locale("en-US")
Var value As Currency

userValue = "$123.45"
value = Currency.FromText(userValue, locale) ' value = 123.45

See Also

Currency.ToText