[][src]Function voca_rs::chop::truncate

pub fn truncate(subject: &str, length: usize, end: &str) -> String

Truncates subject to a new length.

Arguments

Example

use voca_rs::*;
chop::truncate("Once upon a time", 7, "");
// => "Once..."
chop::truncate("Die Schildkröte fliegt über das Floß.", 28, "(...)");
// => "Die Schildkröte fliegt (...)"
chop::truncate("Once upon", 10, "");
// => "Once upon"
use voca_rs::Voca;
"Once upon a time"._truncate(7, "");
// => "Once..."