truncate white space

Truncate a string at a certain length, using the closest whitespace character.

Usage

Add the following to your Cargo.toml

toml truncate_string_at_whitespace = "1.0.2"

Then

```rust use truncatestringatwhitespace::truncatetext;

fn main () { let s = "This is a string that I want to truncate"; let st = truncatetext(s, 12); asserteq!(st, "This is a"); let st2 = truncatetext(s, 16); asserteq!(st2, "This is a string"); } ```

Licence

© 2021 Todd Kennedy, Apache-2.0