Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/stdx/src/lib.rs')
| -rw-r--r-- | crates/stdx/src/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 43909fff02..cd5285295a 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs @@ -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; |