[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

string search

jabowen

6/21/2007 9:05:00 PM

@speed += 1 if sp.slice(8..13) == "03X16"

I've pulled bits 8 though 13 from my string and want
to see if it equal 03X16 where X is number 0-9.
Something like "grep -c 03.16 temp" would work. I've
tried \d of course this did not work.

Thanks
Jeff




____________________________________________________________________________________
Get your own web address.
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?...

1 Answer

Tim Hunter

6/21/2007 9:31:00 PM

0

Jeffrey Bowen wrote:
> @speed += 1 if sp.slice(8..13) == "03X16"
>
> I've pulled bits 8 though 13 from my string and want
> to see if it equal 03X16 where X is number 0-9.
> Something like "grep -c 03.16 temp" would work. I've
> tried \d of course this did not work.
>
>

@speed += 1 if (/03\d16/.match(sp.splice(8..13)))

--
RMagick OS X Installer [http://rubyforge.org/project...]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?for...]
RMagick Installation FAQ [http://rmagick.rubyforge.org/instal...]