Crate outerspace

Source
Expand description

Methods for prefixing and suffixing the non-whitespace characters in a string.

§Examples

let wrapped = outerspace::wrap_non_whitespace("\n\nHello hello\n\n", "**", "**");
assert_eq!(wrapped, "\n\n**Hello hello**\n\n");
let prefixed = outerspace::prefix_non_whitespace("\n\nHello hello\n\n", "> ");
assert_eq!(prefixed, "\n\n> Hello hello\n\n");
let suffixed = outerspace::suffix_non_whitespace("\n\nHello hello\n\n", "!");
assert_eq!(suffixed, "\n\nHello hello!\n\n");

Functions§

prefix_non_whitespace
Insert a prefix into the string before the first non-whitespace character.
suffix_non_whitespace
Insert a suffix into the string after the last non-whitespace character.
wrap_non_whitespace
Insert a prefix and a suffix into the string. The prefix is inserted before the first non-whitespace character. The suffix is inserted after the last non-whitespace character.