string_arithmetic: String operators

Description Usage Arguments Author(s) Examples

Description

Perform string concatenation and arithmetic is a similar way to other languages. String division is not present in languages like Python, although arguably it is more useful than string multiplication and can be used with regulr expressions.

Usage

1
2
3
4
5
6
7
x %+% y

x %-% y

x %s*% y

x %s/% y

Arguments

x

a string

y

a string

Author(s)

Ben Wiseman, benjamin.wiseman@kornferry.com

Examples

1
2
3
4
5
6
("ab" %+% "c") == "abc" # TRUE
("abc" %-% "b") == "ac" # TRUE
("ac" %s*% 2) == "acac" # TRUE
("acac" %s/% "c") == 2  # TRUE
# String division with a regular expression:
'an apple a day keeps the malignant spirit of Steve Jobs at bay' %s/% 'Steve Jobs|apple'

roperators documentation built on Feb. 10, 2022, 1:07 a.m.