Function in conv coil-stdlib

int_to_hex

fn int_to_hex(int n) -> string
Import
use conv::{int_to_hex};
Source: src/conv.hy

Formats n in lowercase hexadecimal without a prefix; a negative n gets a leading -.

Parameters#

NameType
nint

Returns#

string

Examples#

use conv::{int_to_hex};
use tests::assert;
assert!(int_to_hex(255) == "ff");

See also#

  • int_to_dec: Formats n in decimal; the same as format("%i", n).
  • int_to_bin: Formats n in binary without a prefix; a negative n gets a leading -.
  • parse_int_radix: Parses an integer written in base radix, which must be 10 or 16.
  • parse_int: Parses a decimal integer, such as "42", " -7 " or "+3".
  • parse_float: Parses a decimal float such as "3.5", "-0.25", "1e3" or "42".
↑ ↓ navigate ↵ open