Non-decimal radices/Input: Difference between revisions

Add source for Rust
m (→‎{{header|Wren}}: Library name change.)
(Add source for Rust)
Line 953:
% (text, base, int(text, base)))
 
String '100' in base 2 is 4 in base 10
String '100' in base 3 is 9 in base 10
Line 1,223:
p oct3.scanf("%o") # => [4009]
# no scanf specifier for binary numbers.</lang>
 
=={{header|Rust}}==
<lang Rust>fn main() {
println!(
"Parse from plain decimal: {}",
"123".parse::<u32>().unwrap()
);
 
println!(
"Parse with a given radix (2-36 supported): {}",
u32::from_str_radix("deadbeef", 16).unwrap()
);
}</lang>
 
=={{header|Scala}}==
Anonymous user