2 releases

0.1.1 Aug 12, 2022
0.1.0 Aug 12, 2022

#2 in #truncation

Download history 2/week @ 2024-02-18 14/week @ 2024-02-25 4/week @ 2024-03-03 6/week @ 2024-03-10 1/week @ 2024-03-17 21/week @ 2024-03-24 26/week @ 2024-03-31

55 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

~555KB