#string #character #non-whitespace #suffixing #prefixing

outerspace

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

3 unstable releases

0.2.1 Oct 23, 2021
0.2.0 Oct 23, 2021
0.1.0 Mar 10, 2021

#1041 in Text processing

Apache-2.0

8KB
89 lines

outerspace-rs

Crates.io version Crates.io downloads docs.rs docs

This is the Rust version of the outerspace JavaScript package.

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

Examples

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");
let wrapped = outerspace::wrap_non_whitespace("\n\nHello hello\n\n", "**", "**");
assert_eq!(wrapped, "\n\n**Hello hello**\n\n");

No runtime deps