toNumeric

Cast a value to a number.

toNumeric(value [, radix]) → returns numeric

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

value any
Required

radix any
Default: 10

The base of the value.
Values:
  • 2
  • ...
  • 36
  • bin
  • oct
  • dec
  • hex

Examples
Sample code invoking the toNumeric function

toNumeric("29.5")

Expected Result: 29.5

toNumeric("FF0011", "hex")

Expected Result: 16711697

toNumeric("1010", "bin")

Expected Result: 10

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub