Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Liquid filters on strings: upcase, downcase, capitalize

fn main() {
    let template = liquid::ParserBuilder::with_stdlib()
        .build()
        .unwrap()
        .parse(
            "
           plain: {{text}}
           upcase: {{text | upcase}}
           downcase: {{text | downcase}}
           capitalize: {{text | capitalize}}
        ",
        )
        .unwrap();

    let text = "this is Some tExt";

    let globals = liquid::object!({
        "text": text,
    });
    let output = template.render(&globals).unwrap();

    println!("{}", output);
}

           plain: this is Some tExt
           upcase: THIS IS SOME TEXT
           downcase: this is some text
           capitalize: This is Some tExt
        

  • upcase
  • downcase
  • capitalize