String search backwards?

T

Toby DiPasquale

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top