[Wtr-general] How do I set the end of a string to a variable?

Paul Carvalho tester.paul at gmail.com
Tue May 16 16:12:38 EDT 2006


That's perfect.  Thanks.  I found that 'sub' works just as well in this case
because it's just the first occurrence of the pattern that I want to get rid
of.

Cheers!  Paul.


On 16/05/06, Andy Sipe <andy__s at hotmail.com> wrote:
>
> Assuming that the first part of the label is always the same, then gsub is
> one of many ways:
>
> irb(main):017:0> x = 'Good Morning, Billy Bob Joe'
> => "Good Morning, Billy Bob Joe"
> irb(main):018:0> x.gsub(/Good Morning, /, '')
> => "Billy Bob Joe"
>
> -andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060516/62cb90ad/attachment.html 


More information about the Wtr-general mailing list