Skip to main content

to_pascal_case

Function to_pascal_case 

pub fn to_pascal_case(value: &str) -> String
Expand description

Splits value into words on _/-/ boundaries and ASCII uppercase transitions (so echoName -> ["echo", "Name"] and already_snake -> ["already", "snake"]), then re-joins with each word’s first character uppercased and the rest lowercased.

echoName -> EchoName, already_snake -> AlreadySnake, HTTPServer -> Httpserver (consecutive uppercase letters are not treated as separate words — this function optimizes for the camelCase/snake_case identifiers .cstack schemas actually use, not acronym-preserving casing).