rocal-core 0.3.0

Core for Rocal - Full-Stack WASM framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pub fn to_snake_case(input: &str) -> String {
    let mut result = String::new();

    for (i, c) in input.chars().enumerate() {
        if c.is_uppercase() {
            if i > 0 {
                result.push('_');
            }
            result.push(c.to_ascii_lowercase());
        } else {
            result.push(c);
        }
    }

    result
}