Number names is a Rust library to provide formatted string names for cardinal and ordinal numbers.

Overview

Number Names

build License codecov crates.io

Number names is a Rust library to provide formatted string names for cardinal and ordinal numbers.

At this time, only American English is supported, but there are future plans for i18n.

Example usage:

assert_eq!(number_names::cardinal(10), "ten");
assert_eq!(number_names::ordinal(10), "tenth");

See full documentation at https://docs.rs/number-names/.

Contributing

As this is my first project in Rust, I'm sure there are significant improvements to be made in both the algorithms and implementation. I will gladly accept any constructive criticisms, suggestions or pull requests that make this small project more efficient or accurate.

More specific needs include expanding the library to more languages. To add a language, create a file in the /languages folder with the IETF language tag for the language, in snake_case. Implement the cardinal_with_format and ordinal_with_format public functions, returning Strings for each u64 number. Add a tests module (either separately or in the same file) with tests covering several generic as well as specific edge-cases for the language. Add an option to the number_names::languages::Language enum with the IETF tag in CamelCase. Send me a pull request with the completed changes once all your tests are passing!

Roadmap

With the release of version 0.2.0 that saw significant refactoring to make the library more extensible for both formatting and languages, my hope is that the API is now relatively stable. I hope developers will open issues or submit enhancements to help strengthen these foundations. I will continue to maintain this library and intend to promote the most current version to 1.0 to signify stability no sooner than 6 months after the most recent breaking change.

You might also like...
Simple macros to write colored and formatted text to a terminal. Based on `termcolor`, thus also cross-platform.
Simple macros to write colored and formatted text to a terminal. Based on `termcolor`, thus also cross-platform.

Bunt: simple macro-based terminal colors and styles bunt offers macros to easily print colored and formatted text to a terminal. It is just a convenie

Make ELF formatted apps configurable
Make ELF formatted apps configurable

elfredo `elfredo` is a library that allows you to patch executables after they were compiled. It utilize an extra embedded section to store data/confi

Rust library for reading/writing numbers in big-endian and little-endian.

byteorder This crate provides convenience methods for encoding and decoding numbers in either big-endian or little-endian order. Dual-licensed under M

A library for python version numbers and specifiers, implementing PEP 440

PEP440 in rust A library for python version numbers and specifiers, implementing PEP 440 Not yet on crates.io due to PyO3/pyo3#2786. use std::str::Fro

A Rust trait to convert numbers of any type and size to their English representation.

num2english This Rust crate provides the NumberToEnglish trait which can be used to convert any* number to its string representation in English. It us

A SQLite extension for quickly generating random numbers, booleans, characters, and blobs

sqlite-fastrandom A SQLite extension for quickly generating random numbers, booleans, characters, and blobs. Not cryptographically secure. Based on sq

This repository presents a numbers vizualizer in a polar base. This small project has been entirely made in Rust !

NumbersRepresentation This repository presents a numbers vizualizer in a polar base. This small project has been entirely made in Rust ! This is an id

Multiple precision floating point numbers implemented purely in Rust.

Multiple precision floating point numbers implemented purely in Rust. Rationale There are several notable implementations of numbers with increased pr

Zei is a library that provide tools to create and verify public transaction with confidential data.
Zei is a library that provide tools to create and verify public transaction with confidential data.

#Zei: Findora's Cryptographic Library Zei is a library that provide tools to create and verify public transaction with confidential data. Support: Bas

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers
Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers. It deals only with integer arithmetic. Expressions may involve mixed bases (limited to decimal, hexadecimal, octal and binary numbers). The global output format may be set to a particular radix - by default it is hex.

CLI tool to convert numbers from one base to another

changebase A CLI tool for changing the base of numbers. changebase -h numeric base converter USAGE: changebase [FLAGS] [OPTIONS] value FLAG

Print out some fibonacci numbers.

give-me-some-fibonacci A Rust library for some fibonacci. TL;DR: its just a joke. Usage To get started using give_me_some_fibonacci, just add this to

A complex numbers, graphing, cli calculator

calc requires gnuplot for graphing history file is stored in ~/.config/.calc_history or C:\\Users\\%USERNAME%\\AppData\\Roaming\\calc.history usage Us

A fantastic crate for fmting numbers using the appropriate unciode characters.

fmtastic ✨ A fantastic crate for fmting numbers using the appropriate unicode characters via the Display trait. ✨ Supports vulgar fractions, super- an

A small random number generator hacked on top of Rust's standard library. An exercise in pointlessness.

attorand from 'atto', meaning smaller than small, and 'rand', short for random. A small random number generator hacked on top of Rust's standard libra

A Rust library for random number generation.

A Rust library for random number generation.

Rust library of custom number malarkey, including variable-bit-width integers

Numberwang The Numberwang crate is a library of custom number types and functionality, including variable-bit-width integers. It is named after the fi

Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.

Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.

Culture ship names in a rust library.

General Systems Vehicles Culture Ships In case you ever needed Iain M. Banks's Culture ship names as a service. Names sourced from the pleasingly exte

Comments
  • Update rstest requirement from 0.11.0 to 0.12.0

    Update rstest requirement from 0.11.0 to 0.12.0

    Updates the requirements on rstest to permit the latest version.

    Release notes

    Sourced from rstest's releases.

    0.12.0

    Introduce #[once] fixture attribute

    Changelog

    Sourced from rstest's changelog.

    [0.12.0] 2021/12/12

    Add

    • Add #[once] fixture attribute to create static fixtures (See #119)

    Fixed

    • Fixed check of available features before to enable macro diagnostic (See #126)

    [0.11.0] 2021/08/01

    Fixed

    • use mutable fixture in in cases and value list (See #121)

    [0.10.0] 2021/05/16

    Add

    Fixed

    • Wired behaviour in #[fixture] with generics types that have transitive reference (See #116)

    [0.9.0] 2021/05/2

    Add

    • #[future] arg attribute to remove impl Future<> boilerplate. (See #98)

    [0.8.0] 2021/4/25

    Add

    • Magic Conversion: use literal string for define values where type implements FromStr trait (See #111)

    Changed

    • #[default] arg attribute cannot use key = arbitrary rust expression syntax (is unstable rust-lang/rust#78835). So we switched to #[default(expression)] syntax. (See #117)

    Fixed

    • #117 introduced an unstable syntax

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Update rstest requirement from 0.11.0 to 0.13.0

    Update rstest requirement from 0.11.0 to 0.13.0

    Updates the requirements on rstest to permit the latest version.

    Release notes

    Sourced from rstest's releases.

    0.13.0

    Timeout

    Introduce #[timeout] attribute

    Changelog

    Sourced from rstest's changelog.

    [0.13.0] 2022/05/15

    Add

    • #[timeout(duration)] test implementation for both sync and async tests (See #136)

    Changed

    • Split rstest in separated crates for macro and libs (See #32)

    [0.12.0] 2021/12/12

    Add

    • Add #[once] fixture attribute to create static fixtures (See #119)

    Fixed

    • Fixed check of available features before to enable macro diagnostic (See #126)

    [0.11.0] 2021/08/01

    Fixed

    • use mutable fixture in in cases and value list (See #121)

    [0.10.0] 2021/05/16

    Add

    Fixed

    • Wired behaviour in #[fixture] with generics types that have transitive reference (See #116)

    [0.9.0] 2021/05/2

    Add

    • #[future] arg attribute to remove impl Future<> boilerplate. (See #98)

    [0.8.0] 2021/4/25

    Add

    • Magic Conversion: use literal string for define values where type implements FromStr trait (See #111)

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
Releases(v0.2.0)
Owner
Calteran
Calteran
A rust crate for mathematics and science

Scilib A Rust crate for scientific processes Overview This crate is designed to help any mathematical or scientific processes for the Rust community.

H.G. Vivien 15 Oct 20, 2022
A STARK prover and verifier for arbitrary computations.

A STARK is a novel proof-of-computation scheme to create efficiently verifiable proofs of the correct execution of a computation. The scheme was developed by Eli Ben-Sasson, Michael Riabzev et al. at Technion - Israel Institute of Technology. STARKs do not require an initial trusted setup, and rely on very few cryptographic assumptions. See references for more info.

Novi 512 Jan 3, 2023
Super-fast float parser in Rust

fast-float This crate provides a super-fast decimal number parser from strings into floats.

Ivan Smirnov 241 Dec 10, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
An efficient method of heaplessly converting numbers into their string representations, storing the representation within a reusable byte array.

NumToA #![no_std] Compatible with Zero Heap Allocations The standard library provides a convenient method of converting numbers into strings, but thes

Michael Murphy 42 Sep 6, 2022
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. Authors: Sanjay Ghem

Google 31.5k Jan 1, 2023
`rusty_regex` takes an input string and produces a `regex` string representing what was provided.

rusty_regex This project provides a binary that takes an input string, and preps it for regex usage, effectively replacing known generics and producin

Chris Speakes 2 Dec 31, 2022
An annotated string type in Rust, made up of string slices

A string type made up of multiple annotated string slices.

Togglebit 3 Dec 29, 2022
`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please

dbg-pls A Debug-like trait for rust that outputs properly formatted code Showcase Take the following code: let code = r#" [ "Hello, World!

Conrad Ludgate 12 Dec 22, 2022
This app reads a csv file and sends an email with a formatted Handlebars file.

Bulkmail This app reads a csv file and sends an email with a formatted Handlebars file. This can be run on Linux for AMD64 and ARMv7. Upstream Links D

Giovanni Bassi 17 Nov 3, 2022