Re: Keep only one part of a string
- From: Paul Lutus <nospam@xxxxxxxxxx>
- Date: Fri, 15 Sep 2006 03:01:49 -0700
Zouplaz wrote:
le 15/09/2006 01:43, Eero Saynatkari nous a dit:
Zouplaz wrote:
Hello, how to better write that : self.ident = self.ident[/0-9*/]
I'm pretty sure there is a String method that would keep only the first
match of the regex but I didn't found it in the String doc reference
ri String#slice, ri String#slice!
Thanks
Fine ! Thanks... About the same topic (Strings) I wonder how to replace
"REF:90 REFERAL".gsub!('REF:','')
by something else
What something else? Please say specifically what you want to accomplish.
Post an example string before you apply your desired remedy, and after.
I tried with .delete but
"REF:90 REFERAL".delete!("REF:") delete every R, E or F char in the string
How to use delete ?
You are asking how to apply a particular solution, but without first stating
a problem. Maybe the problem is better solved using a different method.
--
Paul Lutus
http://www.arachnoid.com
.
- Follow-Ups:
- Re: Keep only one part of a string
- From: Zouplaz
- Re: Keep only one part of a string
- References:
- Keep only one part of a string
- From: Zouplaz
- Re: Keep only one part of a string
- From: Eero Saynatkari
- Re: Keep only one part of a string
- From: Zouplaz
- Keep only one part of a string
- Prev by Date: Re: Benchmark for Ruby
- Next by Date: Re: Keep only one part of a string
- Previous by thread: Re: Keep only one part of a string
- Next by thread: Re: Keep only one part of a string
- Index(es):
Relevant Pages
|