Perform string concatenation and arithmetic in a similar way to other
languages. String addition (%+%) glues strings together, string
subtraction (%-%) removes a pattern, string multiplication
(%s*%) repeats a string, and string division (%s/%) counts how
many times a pattern occurs. String division has no equivalent in languages
like 'Python', yet is arguably more useful than string multiplication, and it
accepts regular expressions.
Author
Ben Wiseman, benjamin.h.wiseman@gmail.com
Examples
("ab" %+% "c") == "abc" # TRUE
#> [1] TRUE
("abc" %-% "b") == "ac" # TRUE
#> [1] TRUE
("ac" %s*% 2) == "acac" # TRUE
#> ac
#> TRUE
("acac" %s/% "c") == 2 # TRUE
#> c
#> TRUE
# String division with a regular expression:
"an apple a day keeps the malignant spirit of Steve Jobs at bay" %s/% "Steve Jobs|apple"
#> Steve Jobs|apple
#> 2