From: Robert Klemme Date: 2012-04-19T17:48:39+09:00 Subject: Re: Converting CSV On Thu, Apr 19, 2012 at 12:19 AM, Jan E. wrote: > Robert Klemme wrote in post #1057261: >> I'd also rather use the proper tool for >> the job instead of cooking something with regexp. > > Well, that's probably a question of personal preferences. I don't think > it's necessary to load a complete library for every tiny task that comes > around. > > I mean: If I want to do some simple matrix calculations for example, I > don't really need a full 100 MB algebra library. Of course you can write everything yourself. For any other than trivial applications it's absurd though. Plus, even for the small ones using a lib which exists vs. coding yourself is often quicker. As always, it's a matter of tradeoffs. Btw, your code creates two copies of the input. You could reduce memory requirements by using String#gsub! instead of String#gsub. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/