[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: String search backwards?

Gennady Bystritsky

1/24/2006 8:10:00 PM

n = orig_str.rindex(sub_str)

Does it help?
Gennady.

-----Original Message-----
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf
Of Toby DiPasquale
Sent: Tuesday, January 24, 2006 12:06
To: ruby-talk ML
Subject: String search backwards?

Hi all,

Can Ruby search a string backwards? I can't find any reference to this
in the docs or online, but it seems as if you should be able to do this.

What I would like, ideally, is a method like:

n = rstrstr( orig_str, sub_str)

where n is the starting index of the last occurrence of sub_str in
orig_str. Anybody know how to do this? I tried using the 'r' modifier to
// but that failed as well.

--
Posted via http://www.ruby-....