Function capitalize

Source
pub fn capitalize(s: impl Display) -> Result<String, Error>
Expand description

Capitalize a value. The first character will be uppercase, all others lowercase.

/// ```jinja
/// <div>{{ example|capitalize }}</div>
/// ```
#[derive(Template)]
#[template(ext = "html", in_doc = true)]
struct Example<'a> {
    example: &'a str,
}

assert_eq!(
    Example { example: "hello" }.to_string(),
    "<div>Hello</div>"
);

assert_eq!(
    Example { example: "hElLO" }.to_string(),
    "<div>Hello</div>"
);