Logo

Programming-Idioms

History of Idiom 142 > diff from v14 to v15

Edit summary for version 15 by GobbleCock:
New Rust implementation by user [GobbleCock]

Version 14

2017-10-28, 11:11:15

Version 15

2018-06-12, 17:38:25

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Extra Keywords
hex hexa radix
Extra Keywords
hex hexa radix
Code
let s = format!("{:X}", x);
Comments bubble
{:X} produces uppercase hex.
{:x} produces lowercase hex.
Doc URL
https://doc.rust-lang.org/nightly/std/fmt/index.html