Skip to content

2016-9: Delimited Text

It's common to encounter delimited text – for example, comma- separated values in a file.

Write a function that takes a character vector as its right argument and one or more characters as its left argument, where those characters are delimiters in the right argument. The function should return the delimited text as a vector of vectors.

Examples:

      ',' (your_function) 'comma,delimited,values' 
┌─────┬─────────┬──────┐
│comma│delimited│values│
└─────┴─────────┴──────┘
      ' ' (your_function) 'break up words'
┌─────┬──┬─────┐
│break│up│words│
└─────┴──┴─────┘
      ',' (your_function) ',' 
┌┬┐
│││
└┴┘
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub