mirror of
https://github.com/euzu/tuliprox.git
synced 2026-09-30 13:02:10 +02:00
Telegram markdown support for structured json messages
This commit is contained in:
@@ -106,6 +106,27 @@ pub fn mask_credentials(s: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn humanize_snake_case(s: &str) -> String {
|
||||
let mut result = String::with_capacity(s.len());
|
||||
let mut capitalize_next = true;
|
||||
|
||||
for c in s.chars() {
|
||||
if c == '_' {
|
||||
result.push(' ');
|
||||
capitalize_next = true;
|
||||
} else if capitalize_next {
|
||||
for up in c.to_uppercase() {
|
||||
result.push(up);
|
||||
}
|
||||
capitalize_next = false;
|
||||
} else {
|
||||
result.push(c);
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::collections::HashSet;
|
||||
|
||||
Reference in New Issue
Block a user