@@ -0,0 +1,995 @@
+package railo.runtime.functions.other;%0A%0Aimport railo.runtime.PageContext;%0Aimport railo.runtime.exp.FunctionException;%0Aimport railo.runtime.exp.PageException;%0Aimport railo.runtime.op.Caster;%0Aimport railo.runtime.op.Decision;%0A%0Apublic class ToNumeric %7B%0A%09public static double call(PageContext pc , Object value) throws PageException %7B%0A%09%09return Caster.toDoubleValue(value);%0A%09%7D%0A%09public static double call(PageContext pc , Object value, Object oRadix) throws PageException %7B%0A%09%09int radix;%0A%09%09if(Decision.isNumeric(oRadix))%7B%0A%09%09%09radix=Caster.toIntValue(oRadix);%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09String str = Caster.toString(oRadix).trim().toLowerCase();%0A%09%09%09if(%22bin%22.equals(str)) radix=2;%0A%09%09%09else if(%22oct%22.equals(str)) radix=8;%0A%09%09%09else if(%22dec%22.equals(str)) radix=10;%0A%09%09%09else if(%22hex%22.equals(str)) radix=16;%0A%09%09%09else throw new FunctionException(pc, %22ToNumeric%22, 2, %22radix%22, %22invalid value %5B%22+str+%22%5D, valid values are %5B%3Cnumber%3E,bin,oct,dec.hex%5D%22);%0A%09%09%7D%0A%09%09%0A%09%09return (double)Integer.parseInt(Caster.toString(value), radix);%0A%09%7D%0A%7D%0A

add function toNumeric