This language bar is your friend. Select your favorite languages!

Idiom #142 Hexadecimal digits of an integer

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

E.g. 999 -> "3e7"

let s = format!("{:X}", x);
String s = x.ToString("x")
import std.conv;
s = to!string(x, 16);
import std.format;
s = format("%x", x);
import "fmt"
import "math/big"
s := fmt.Sprintf("%x", x)
import "strconv"
s := strconv.FormatInt(x, 16)
s = string.format("%x",x)
uses sysutils;
s := IntToHex(x);
s = format(x, 'x')
s = x.to_s(16)

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

Related idioms