Currency.From

Last updated 5 months ago

Currency.From

Returns a currency value from the given value.

function (optional value as nullable any, optional culture as nullable any, optional roundingMode as nullable any) as nullable any

Description

Returns a currency value from the given value. If the given value is null, Currency.From returns null. If the given value is number within the range of currency, fractional part of the value is rounded to 4 decimal digits and returned. If the given value is of any other type, see Number.FromText for converting it to number value, then the previous statement about converting number value to currency value applies. Valid range for currency is -922,337,203,685,477.5808 to 922,337,203,685,477.5807. See Number.Round for the available rounding modes, the default is RoundingMode.ToEven.

Category

Number.Conversion and formatting

Examples

Get the currency value of "1.23455".

Currency.From("1.23455")

1.2346

Get the currency value of "1.23455" using RoundingMode.Down.

Currency.From("1.23455", "en-Us", RoundingMode.Down)

1.2345