------art_45921_27139730.1168624056891
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 1/12/07, James Edward Gray II <james / grayproductions.net> wrote:
>
> On Jan 12, 2007, at 11:35 AM, Robert Dober wrote:
>
> > On 1/12/07, Josselin <josselin / wanadoo.fr> wrote:
> >>
> >> I wrote the following ruby statements..  I get the result I need , I
> >> tried to DRY it for 2 hours without being successfull ,
> >>
> >>       d  .gsub(/\r\n/,' ')   # get rid of carriage return
> >>       d  .gsub(/;/,' ')  # replace column by space
> >>       d  .gsub(/,/,' ') # replace comma by space
> >>       a   .split(' ')   # split into component , space as divider
> >>
> >> tfyl
> >>
> >> Joss
> >
> >
> > I know you got lots of answers but what about
> >
> > a  .gsub(/;|,/," ").split
>
> No need for a Regexp there:
>
> a  .tr(";,", " ").split
>
> James Edward Gray II
>
> Nice one ( I thought I got it optimal, naaa)
and faster too of course :)

robert@PC:~/log/ruby/ML 18:46:00
535/35 > ruby split.rb split.rb
Rehearsal ---------------------------------------------
regex       4.891000   0.000000   4.891000 (  4.602000)
translate   3.812000   0.000000   3.812000 (  3.685000)
------------------------------------ total: 8.703000sec

                user     system      total        real
regex       5.016000   0.000000   5.016000 (  4.669000)
translate   3.859000   0.000000   3.859000 (  3.805000)

Cheers
Robert

------art_45921_27139730.1168624056891--