pub fn string_case(
val: &str,
args: Vec<&str>,
) -> Result<String, TransformerError>
Expand description
Format the string. Supports up
=> UPCASE, down
=> downcase, proper
=> first character UPCASE all others downcase, title
=> title case according to titlecase::titlecase
. e.g. {var:case(up)}
.
assert_eq!(string_case("na", vec!["up"])?, "NA");
assert_eq!(string_case("nA", vec!["down"])?, "na");
assert_eq!(string_case("nA", vec!["proper"])?, "Na");
assert_eq!(string_case("here, an apple", vec!["title"])?, "Here, an Apple");