Function voca_rs::chop::limit_words
source · Expand description
Limits the subject
length to a number
of words. Removes trailing commas and other punctuation.
Arguments
subject
- The string to truncate.number
- The limit number of words.end
- The string to be added at the end. Default value is “…”.
Example
use voca_rs::*;
chop::limit_words("zen and the art of Motorcycle Maintenance", 4, "");
// => "zen and the art..."
chop::limit_words("Die Schildkröte, fliegt über das Floß.", 2, "(...)");
// => "Die Schildkröte(...)"
chop::limit_words("Once upon", 10, "");
// => "Once upon"
use voca_rs::Voca;
"Once upon a time"._limit_words(1, "");
// => "Once..."