Latest Version Documentation

This crate adds a tool to format a number in an arbitrary base from 2 to 36.

This is a light crate, without any dependency.

For primitive signed integers (i8 to i128, and isize), negative values are formatted as the two’s complement representation.

There is also one specific function for each radix that does not already exists in the standard library, e.g. radix_3 to format a number in base 3.

Get started

Add the crate in the cargo manifest:

toml radix_fmt = "1"

Import radix in scope, and you are ready to go:

rust use radix_fmt::radix;

Examples

```rust use radix_fmt::*;

let n = 35;

// Ouput: "z" println!("{}", radix(n, 36)); // Same ouput: "z" println!("{}", radix_36(n)); ```

You can use the alternate modifier to capitalize the letter-digits:

```rust use radix_fmt::radix;

let n = 35;

// Ouput: "Z" println!("{:#}", radix(n, 36)); ```

FAQ