pub fn count(val: &str, args: Vec<&str>) -> Result<String, TransformerError>
Expand description

Count the number of occurances of a pattern in the string. You can chain it with calc to get the number of word like: {val:count( ):calc(+1)}

    assert_eq!(count("nata", vec!["a"])?, "2");
    assert_eq!(count("nata", vec!["a", "t"])?, "2,1");
    assert_eq!(count("nata", vec![" "])?, "0");
    assert_eq!(count("hi there fellow", vec![" "])?, "2");