10 releases

0.1.9 Jan 9, 2024
0.1.8 Mar 6, 2023
0.1.7 Feb 24, 2023
0.1.6 Jan 30, 2023
0.1.3 Jul 22, 2020

#699 in Text processing

MIT/Apache

6KB
81 lines

Actions Status

abbreviator

A Rust library for abbreviating long words.

Example usage

Add the library to your dependencies

[dependencies]
abbreviator = "0.1.8"

and then use it.

use abbreviator::abbreviate;

fn main() {
    println!("{}", abbreviate("")); // prints ""
    println!("{}", abbreviate("a")); // prints "a"
    println!("{}", abbreviate("ab")); // prints "ab"
    println!("{}", abbreviate("abc")); // prints "a1c"
    println!("{}", abbreviate("word")); // prints "w2d"
    println!("{}", abbreviate("localization")); // prints "l10n"
    println!("{}", abbreviate("internationalization")); // prints "i18n"
    println!("{}", abbreviate("pneumonoultramicroscopicsilicovolcanoconiosis")); // prints "p43s"
}

Dependencies

~355KB