Anonymous user
Non-decimal radices/Input: Difference between revisions
Added Oz.
(add JavaScript) |
(Added Oz.) |
||
Line 219:
# Scanf.sscanf "7651" "%o" (fun x -> x);;
- : int = 4009</lang>
=={{header|Oz}}==
<code>String.toInt</code> understands the usual prefixes. If a string cannot be parsed, an exception will be thrown.
<lang oz>{String.toInt "42"} %% decimal
= {String.toInt "0x2a"} %% hexadecimal
= {String.toInt "052"} %% octal
= {String.toInt "0b101010"} %% binary</lang>
=={{header|Perl}}==
|