Description
CCur returns a Currency value created by
converting the given Number, Currency or String type argument to a Currency
value.
Overloads
CCur (number or currency)
Arguments
number or currency is a Number or
Currency value or expression.
string is a String value or
expression.
Action
CCur returns a Currency value created by
converting the given Number, Currency or String type argument to a Currency
value. If the conversion cannot be done, an error occurs.
Examples
CCur (200.20)
In Crystal syntax this is equivalent to
writing $200.20. In Basic syntax, CCur (200.20) is the way to directly create a
Currency value of 200.20.
CCur ("$200.20")
Returns the Currency value CCur (200.20)
given the String value "$200.20".
CCur ("two hundred dollars")
Causes an error to occur. The CCur
function cannot convert the String "two hundred dollars" to a Currency value.
Comments
You can use the
IsNumeric (str) or
NumericText (str) function to check if the
String argument can be converted to a Currency before doing the actual
conversion. That way, if the conversion cannot be done, you can handle the
situation appropriately.
In Crystal syntax, you can use the
“To currency” operator instead of CCur
when converting from a Number value to a Currency value.