Skip to main content

to_snake_case

Function to_snake_case 

pub fn to_snake_case(s: &str) -> String
Expand description

Common key transformation: convert PascalCase to snake_case.

ยงExamples

use noyalib::with::singleton_map_with::to_snake_case;

assert_eq!(to_snake_case("GetRequest"), "get_request");
assert_eq!(to_snake_case("HTTPServer"), "h_t_t_p_server");
assert_eq!(to_snake_case("already_snake"), "already_snake");