Crates.io | abbreviator |
lib.rs | abbreviator |
version | 0.1.9 |
source | src |
created_at | 2020-07-20 17:18:50.232927 |
updated_at | 2024-01-09 10:14:13.4637 |
description | A library for abbreviating long words. |
homepage | |
repository | https://github.com/Vagelis-Prokopiou/abbreviator |
max_upload_size | |
id | 267318 |
size | 6,251 |
A Rust library for abbreviating long words.
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"
}