#formatting #numbers #ordinals #3rd #2nd #format #1st

ordinal

Formatting of ordinals (1st, 2nd, 3rd etc)

8 releases

0.3.2 Jan 31, 2022
0.3.1 Jan 26, 2022
0.2.3 Jun 16, 2020
0.2.2 Aug 7, 2018
0.1.0 Apr 11, 2016

#1016 in Algorithms

Download history 1792/week @ 2024-06-19 1428/week @ 2024-06-26 1361/week @ 2024-07-03 1740/week @ 2024-07-10 1663/week @ 2024-07-17 2357/week @ 2024-07-24 1801/week @ 2024-07-31 1210/week @ 2024-08-07 1893/week @ 2024-08-14 1389/week @ 2024-08-21 1725/week @ 2024-08-28 1292/week @ 2024-09-04 1060/week @ 2024-09-11 1451/week @ 2024-09-18 1244/week @ 2024-09-25 1208/week @ 2024-10-02

5,210 downloads per month
Used in 11 crates (8 directly)

MPL-2.0 license

9KB
135 lines

Ordinals (1st, 2nd, 3rd etc) for Rust

test lint

This crate provides a type Ordinal<T> that formats an Integer type T as an ordinal number (1st, 2nd, 3rd, etc).

Install

Just add the following line to your Cargo.toml file:

[dependencies]
ordinal = "0.3.2"

Example

use ordinal::Ordinal;

fn main() {
    assert_eq!("2nd", Ordinal(2).to_string());
}

Ownership Context

I am not the original author of this crate. The original author, @dtolnay, didn't want to maintain the crate anymore so he gave it to me. This means that I am the official maintainer of this package. If you want to see where this decision was made check the GitHub issue.

Dependencies

~205KB