diff options
author | Aleksey Kladov <[email protected]> | 2020-05-19 21:25:07 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-20 00:23:05 +0100 |
commit | 8eb3272ad6f774bccb967ee640b72a9a17273e7b (patch) | |
tree | 0255efa99452c826308b41158b1db941d3f4543f /crates/stdx | |
parent | 9c3acd3028d32b6cf099e8d5dffe435f15f241a2 (diff) |
Use snippets in add function
Diffstat (limited to 'crates/stdx')
-rw-r--r-- | crates/stdx/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 0f34ce70e..71a57fba2 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -116,3 +116,11 @@ pub fn to_lower_snake_case(s: &str) -> String { | |||
116 | } | 116 | } |
117 | buf | 117 | buf |
118 | } | 118 | } |
119 | |||
120 | pub fn replace(buf: &mut String, from: char, to: &str) { | ||
121 | if !buf.contains(from) { | ||
122 | return; | ||
123 | } | ||
124 | // FIXME: do this in place. | ||
125 | *buf = buf.replace(from, to) | ||
126 | } | ||