proxmox/proxmox-api-macro/src/util.rs
Wolfgang Bumiller b5c05fc85c import proxmox-api-macro crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-06 15:25:47 +02:00

20 lines
409 B
Rust

pub fn to_camel_case(text: &str) -> String {
let mut out = String::new();
let mut capitalize = true;
for c in text.chars() {
if c == '_' {
capitalize = true;
} else {
if capitalize {
out.extend(c.to_uppercase());
capitalize = false;
} else {
out.push(c);
}
}
}
out
}