How do I get the _last_ occurrence of a character in a string.
Getting the First occurrence is:
Dim first As Integer
first = InStr("this is a test", "s") //returns 4
Last might be something like (Pseudo code):
Dim last As Integer
last = LastInStr("this is a test", "s") //returns 13
// then I could use the Right function
Dim s As String
s=Right( "this is a test" , last) //returns "st"
I don't think there is a function for it. But, I'm sure there must be a
way to do it.
Thanks,
Stephen J. Goodson
PS: As I was proofing this email and looking at the LR (Language
Reference) I thought of
one way to possibly do this (Pseudo code):
Dim count as Integer
Dim s, field as String
s="this is a test"
count=CountFields(s, "s") // should return 4
field= "s" + NthField( s ,"s", count ) // should return... "st"
// But this is a bit... kluge!
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|