Complete
over 4 years ago

Problem with string function toLongWithBase()

I am having some trouble converting hex numbers to integers. I can't seem to make the string.toLongWithBase(base) function work ?

The first test case should be the maximum 32 bit signed integer, the second test case returns null since it is too big. 

I have not idea why the third test case generates an exception as it cannot find the string function toLongWithBase ?

Any ideas ??

Thanks

sNum = "7fffffff";
dNum = sNum.toNumberWithBase(16);
Sys.println("str : " + sNum + " num: " + dNum);    // output = str : 7fffffff num: 2147483647

sNum = "ffffffff";
dNum = sNum.toNumberWithBase(16);
Sys.println("str 1 : " + sNum + " num: " + dNum);  // output = str 1 : ffffffff num: null

sNum = "ffffffff";
dNum = sNum.toLongWithBase(16);                    // output = Error: Symbol Not Found Error Details: Could not find symbol 'toLongWithBase'
Sys.println("str 2 : " + sNum + " num: " + dNum);