Faster CSV process only one row!

Suppose I have a string s, which is basically a CSV, how can I get it as
array using fastercsv? Or any simple way?

On Tue, Sep 4, 2012 at 3:25 PM, ajay paswan [email protected]
wrote:

Suppose I have a string s, which is basically a CSV, how can I get it as
array using fastercsv? Or any simple way?

How about looking at the documentation?

http://rdoc.info/stdlib/csv/CSV

robert

On Tue, Sep 4, 2012 at 7:31 PM, ajay paswan [email protected]
wrote:

robert

I seriously went through that… but may be I dont have patience or I am
not able to follow… seriously I want to follow it… give me any tips to
follow it nicely!

Please go through it once more. There’s a section called “From a
String”, with two subsections: “A line at a time”, and “All at once”
with two ways of parsing a String that contains CSV. I think the one
you want is “All at once”, which will return an array of arrays.

Jesus.

http://rdoc.info/stdlib/csv/CSV

4th example down: arr_of_arrs = CSV.parse(“CSV,data,String”)

Robert K. wrote in post #1074649:

On Tue, Sep 4, 2012 at 3:25 PM, ajay paswan [email protected]
wrote:

Suppose I have a string s, which is basically a CSV, how can I get it as
array using fastercsv? Or any simple way?

How about looking at the documentation?

http://rdoc.info/stdlib/csv/CSV

robert

I seriously went through that… but may be I dont have patience or I am
not able to follow… seriously I want to follow it… give me any tips to
follow it nicely!

On Tue, Sep 4, 2012 at 7:31 PM, ajay paswan [email protected]
wrote:

Robert K. wrote in post #1074649:

On Tue, Sep 4, 2012 at 3:25 PM, ajay paswan [email protected]
wrote:

Suppose I have a string s, which is basically a CSV, how can I get it as
array using fastercsv? Or any simple way?

How about looking at the documentation?

http://rdoc.info/stdlib/csv/CSV

I seriously went through that… but may be I dont have patience or I am
not able to follow… seriously I want to follow it…

If you do not have that much patience then programming is probably not
for you.

give me any tips to follow it nicely!

I attribute your demanding style to you not being a native speaker of
English. Generally your chances of being heard are much better if you
sneak in a “please” in sentences like that.

The hint I’d give: read it carefully from top to bottom.

Good luck

robert

http://rdoc.info/stdlib/csv/CSV

Oh, also, there’s “Convert a Single Line” which has exactly what
you’re looking for.

Robert K. wrote in post #1074753:

I attribute your demanding style to you not being a native speaker of
English. Generally your chances of being heard are much better if you
sneak in a “please” in sentences like that.

Thank you robert, I’ll remember that, I hope I’ll never make same
mistakes again. Thank you all for your valuable replies.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs