Skip to main content

to_pascal_case

Function to_pascal_case 

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

Convert a snake_case, kebab-case, or other string to PascalCase.

Splits on _ and -, capitalises the first character of each segment, and preserves the remaining characters.

ยงExamples

use md_tmpl_core::to_pascal_case;
assert_eq!(to_pascal_case("code_review"), "CodeReview");
assert_eq!(to_pascal_case("task-report"), "TaskReport");