Function outerspace::prefix_non_whitespace[][src]

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

Insert a prefix into the string before the first non-whitespace character.

Returns a heap-allocated String.

Example

let prefixed = outerspace::prefix_non_whitespace("\n\nHello hello\n\n", "> ");
assert_eq!(prefixed, "\n\n> Hello hello\n\n");