From Xojo Documentation

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

Currency.FromText(value As String, Optional locale As Locale) As Currency

New in 2019r2

Supported for all project types and targets.

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


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

If value cannot be converted to a Currency (because it contains non-numeric characters, for example), then a RuntimeException is raised.

Sample Code

Convert values to the Currency type:

Var userValue As String
userValue = "123.45"

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

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

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

See Also