How about passing the string to reverse() first.  Won't be perfect,
because you'll need to reverse your search string as well, and then
subtract the returned index from the length, and unreverse everything
to use it, but it'll function.  YOu can wrap all that up in a UDF
pretty easily.

Or, if you're on CFMX and feeling adventurous, you can use the
lastIndexOf() method of the String class like this:

str = "this is a test string";
i = str.lastIndexOf("is") + 1;

I'm finding the last index of the string "is".  Make sure you add one
to the result though, because Java is zero-indexed while CF is
one-indexed.

cheers,
barneyb

On Fri, 03 Sep 2004 13:59:31 -0400, Josen Ruiseco
<[EMAIL PROTECTED]> wrote:
> I need a function or udf that is like find() or findNoCase() except that it searches backward from a starting point instead of forward.
>
> In other words, it finds the first occurance of a substring within a string but searches backwards from a starting point.
>
> Josen
> GoMotorbids.com

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to