Crate indexing_fmt

Crate indexing_fmt 

Source
Expand description

This crate allows the formatting of integer types as superscripts or subscripts. It consists of two traits, FormatSuperscript & FormatSubscript with which the integers can be formatted.

use indexing_fmt::*;

let index = 12;
let name = format!("Ship{}", index.to_superscript());
assert_eq!(name, "Ship¹²");

let index = 840;
let name = format!("Docking-Bay{}", index.to_subscript());
assert_eq!(name, "Docking-Bay₈₄₀");

Traits§

FormatSubscript
Responsible for converting to subscripts₁₂₃.
FormatSuperscript
Responsible for converting to superscripts¹²³.