[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: "francisrammeloo () hotmail ! com" <francisrammeloo () hotmail ! com>
Date: 2005-07-30 8:06:02
Message-ID: 1122710625.569915.138190 () g14g2000cwa ! googlegroups ! com
[Download RAW message or body]
I'm sorry but my first post was misleading.
The string actually looks like this:
" BeginCaption 0, 20, 66, .."
(the whitespace can be a combination of tabs and spaces)
So I actually have to cut out "Caption" word in the <<middle>> of the
string.
Brian's hint got me on the right track. The solution I finally found
was:
pane = line.sub(/\s*Begin(\w+).*/, '\1')
Unless some expert can prove a still more tight solution I believe I
have found the best way to cut out the "Caption" part of the string.
Thank you all for your help.
Best regards,
Francis
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic