2022-8: Let"s Split!
Write code that:
- takes a second argument that is a non-empty character vector or scalar.
- takes a first argument that is a non-empty character vector or scalar.
- returns a 2-element vector of character vectors in which the second argument is split immediately before the first occurence of any element in the first argument.
If no first argument element occurs in the second argument, then the split should happen after the last element of the second argument.
Examples
Implementation
You can also run the tests via ⌘/shift + enter