[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Chopping the beginning of a string elegantly
From:       "William James" <w_a_x_man () yahoo ! com>
Date:       2005-07-29 16:56:02
Message-ID: 1122655887.870886.323030 () g14g2000cwa ! googlegroups ! com
[Download RAW message or body]


francisrammeloo@hotmail.com wrote:
> Thanks all,
>
> I eventually used this
>
> thePane = line.scan(/Begin\w+/)[0].sub(/Begin/, "")
>
> where line looks like this:
> BeginCaption				0, 20, 66, ..
>
> It looks a little better but still not very elegant. Is it possible to
> make it even still shorter?

line[/Begin(\w+)/]; thePane = $1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic