Troy wrote:
I have a table with a few rows like the below
No. Name Emp id
1 John 123383
2 Bob 389736
3 Danny 932303
4 Joy 832652
Is there a way to insert the table rows into an array
in Ruby which should look like:
ArrTable= ["1","John","123383"
"2","Bob","389736"
"3","Danny","932303"
"4","Joy","832652" ]
s = "
No. Name Emp id
1 John 123383
2 Bob 389736
3 Danny 932303
4 Joy 832652"
s.strip.lines.drop(1).map(&:split)
==>[["1", "John", "123383"], ["2", "Bob", "389736"], ["3", "Danny", "932303"], ["4", "Joy", "832652"]]
require 'pp'
==>true
pp s.strip.lines.drop(1).map(&:split)
[["1", "John", "123383"],
["2", "Bob", "389736"],
["3", "Danny", "932303"],
["4", "Joy", "832652"]]
--
Amazon bans book. After nearly a month on the site, all traces of the book and its 80 reviews have been removed.
http://jamesfetzer.blogspot.com/2015/11/debunking-sandy-hook-debunkers-5.html https://www.youtube.com/watch?v=EEl_1HWFRfo
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)