Use snippets in add function

This commit is contained in:
Aleksey Kladov 2020-05-19 22:25:07 +02:00
parent 9c3acd3028
commit 8eb3272ad6
5 changed files with 75 additions and 40 deletions

View file

@ -116,3 +116,11 @@ pub fn to_lower_snake_case(s: &str) -> String {
}
buf
}
pub fn replace(buf: &mut String, from: char, to: &str) {
if !buf.contains(from) {
return;
}
// FIXME: do this in place.
*buf = buf.replace(from, to)
}