Function outerspace::wrap_non_whitespace[][src]

pub fn wrap_non_whitespace(s: &str, prefix: &str, suffix: &str) -> String
Expand description

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.

Returns a heap-allocated String.

Example

let wrapped = outerspace::wrap_non_whitespace("\n\nHello hello\n\n", "**", "**");
assert_eq!(wrapped, "\n\n**Hello hello**\n\n");