Loading RustViz Engine...
Sanitize strings allocating a new heap String only if invalid characters exist.
This problem is currently in blueprint template mode. Once the concept foundation is finalized, live in-browser WebAssembly compilation and test assertion runners will be enabled here.
use std::borrow::Cow;
pub fn sanitize_spaces<'a>(input: &'a str) -> Cow<'a, str> {
if input.contains(" ") {
Cow::Owned(input.replace(" ", " "))
} else {
Cow::Borrowed(input)
}
}