move is_upper_snake_case to stdx

This commit is contained in:
davidsemakula 2024-01-16 13:37:22 +03:00
parent 5b2a2bc3fb
commit 1f91c487a2
2 changed files with 5 additions and 3 deletions

View file

@ -171,6 +171,10 @@ pub fn char_has_case(c: char) -> bool {
c.is_lowercase() || c.is_uppercase()
}
pub fn is_upper_snake_case(s: &str) -> bool {
s.chars().all(|c| c.is_uppercase() || c == '_' || c.is_numeric())
}
pub fn replace(buf: &mut String, from: char, to: &str) {
if !buf.contains(from) {
return;