Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
- Ruby
- C
- Clojure
- C++
- C++
- C#
- D
- D
- Dart
- Elixir
- Erlang
- Fortran
- Go
- Go
- Haskell
- JS
- Java
- Java
- Java
- Lisp
- Lua
- PHP
- Pascal
- Pascal
- Perl
- Python
- Python
- Python
- Rust
- Scala
char s[32];
snprintf(s, sizeof(s), "%x", i);
template <typename I>
std::string n2hexstr(I w, size_t hex_len = sizeof(I)<<1) {
static const char* digits = "0123456789ABCDEF";
std::string str(hex_len, '-');
for (size_t i=0, j=(hex_len-1)*4 ; i<hex_len; ++i,j-=4)
str[i] = digits[(w>>j) & 0x0f];
return str;
}
String s = x.ToString("x")
The argument "x" stands for hexadecimal, lowercase.
s = to!string(x, 16);
std.conv.to is the entry point for any standard convertion.
var s = x.toRadixString(16);
s = Integer.to_string(x, 16)
S = io_lib:fwrite("~.16B",[X]).
write (*,'(Z8.8)') x
const s = x.toString(16)
String s = Integer.toHexString(x);
String s = "%x".formatted(x);
(setf s (format nil "~X" x))
s = string.format("%x",x)
S := Format("%x", [x]);
"%x" is the pattern for hex
my $s = sprintf("%x", $i);
s = hex(x)
s = format(x, 'x')
s = '%x' % x
val s = x.toString(16)