FAQ: In Raku, how to check if a String contains a substring ? Where and how many times ? I would like 3 functions such as:
xxx-bool("az and az and az again", "az"); # True
xxx-num("az and az and az again", "az"); # 3
xxx-list("az and az and az again", "az"); # (0 7 14)
PS: Routines index and rindex are pretty cool but only get one match.
Related Links:
"az and az and az again".contains("az"); # True
"az and az and az again".indices("az").elems; # 3
"az and az and az again".indices("az"); # (0 7 14)
PS: Routine indices is described just after index and rindex. So read the good doc, and read it well ;-)
Links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With