Anonymous user
Non-decimal radices/Convert: Difference between revisions
add E example
m (→{{header|Tcl}}) |
(add E example) |
||
Line 320:
writefln(ItoA(60272032366,36)," ",ItoA(591458,36)) ;
}</lang>
=={{header|E}}==
<lang e>def stringToInteger := __makeInt
def integerToString(i :int, base :int) {
return i.toString(base)
}</lang>
<lang e>? stringToInteger("200", 16)
# value: 512
? integerToString(200, 16)
# value: "c8"</lang>
=={{header|Forth}}==
Forth has a global user variable, BASE, which determines the radix used for parsing, interpretation, and printing of integers. This can handle bases from 2-36, but there are two words to switch to the most popular bases, DECIMAL and HEX.
|