eden li
5/2/2007 4:12:00 AM
str = $& if str =~ /something/
Although, running this when str == '' is pretty useless.
On May 2, 10:20 am, "Mike Steiner" <mikejaystei...@gmail.com> wrote:
> I'm new to Ruby, and in a little program I'm writing, I have code like this:
>
> str = ''
> if /something/.match(str)
> str = /something/.match(str)[1]
> end
>
> Is there a more elegant way to do this?
>
> Mike Steiner