Class FromBase

All Implemented Interfaces:
PostfixMathCommandI, Serializable

public class FromBase extends NaryFunction
PostfixMathCommand which converts a string to a number in a given base. Instance of these classes can be specified with two different behaviours either with the base specified in the constructor or with no base specified in which case the function requires two arguments, the second of which is the base. A third form allows a prefix to be specified, this prefix must be present in the Jep expression.

For example

jep.addFunction("fromDec",new FromBase(10));
 jep.parse("fromDec(\"123.45\")");
 jep.addFunction("fromHex",new FromBase(16,"0x"));
 jep.parse("fromHex(\"0xff\")");
 jep.addFunction("fromBase",new FromBase());
 jep.parse("fromBase(\"0377\",8)");
Author:
Rich Morris Created on 02-May-2005
See Also: