If this is for production, you should use the CSV class , as @DmitryZ noted in the comments. CSV processing has an amazing amount of caveats, and you should not do it manually.
But skip it as an exercise ...
, . .
a = text.split(/\n/), a .
a = [
171\t1000\t21\t
269\t1000\t25\t
389\t1000\t40\t
1020\t1-03\t30\t1
1058\t1-03\t30\t1
1074\t1-03\t30\t1
200\t300\t\t500
]
String # split, " , .", u = i.split(/\t/) , .
, 4 , 4.
u = i.split(/\t/, 4)
, , -1, " [] , , ". CSV.
u = i.split(/\t/, -1)
source
share