Function crowbook_text_processing::clean::dashes [] [src]

pub fn dashes<'a, S: Into<Cow<'a, str>>>(input: S) -> Cow<'a, str>

Replace double dashes (--) and triple dashes (---) to en dash and em dash, respectively.

This function can be useful when writing literaty texts, but should be used with caution as double and triple dashes can have special meanings.

Example

use crowbook_text_processing::clean;
let s = clean::dashes("--- Hi, he said -- unexpectedly");
assert_eq!(&s, "— Hi, he said – unexpectedly");