2 releases

0.1.1 Aug 12, 2022
0.1.0 Aug 12, 2022

#2 in #truncation

26 downloads per month

Apache-2.0

5KB
116 lines

Strunc

A string truncating crate.

let output = "very long string".strunc_len(10);
assert_eq!("very lo...", output.to_string());

Different options:

// Default:
"very long string is very long".strunc(); // truncates to 25 characters

// Customize the suffix:
let output = "very long string".strunc_len_suf(15, "....");
assert_eq!("very long s....", output);

Dependencies

~355KB