In javascript we can do parseInt(n,radix); or n.toString(radix);
I see that in Haxe these params are missing.
Are there any ready code in Haxe Std to do the same?
I found here Converting an Integer to Any Base a fairly simple implementation in python
CHAR_FOR_INT = '0123456789abcdef'
def to_string(n, base):
if n < base:
return CHAR_FOR_INT[n]
return to_string(n // base, base) + CHAR_FOR_INT[n % base]
to_string(1453, 16) # => 5Ad
or this in reverse
def to_decimal(number, base):
result = 0
for index, character in enumerate(number):
result += int(character) * base ** index
return result
Anything native haxe?