Dev Helpers
← Back

Split delimited text into rows

Split delimited text into rows using SQLite.

Open this example in the interactive library

Source code

WITH RECURSIVE pieces(word,rest) AS (VALUES('','red,blue,') UNION ALL SELECT substr(rest,1,instr(rest,',')-1),substr(rest,instr(rest,',')+1) FROM pieces WHERE rest<>'') SELECT word FROM pieces WHERE word<>'';

Sample output

[
  {
    "word": "red"
  },
  {
    "word": "blue"
  }
]