InstrRev syntax

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

InstrRev syntax

Post by pgriffin » Wed Oct 11, 2006 2:27 am

I'm struggling with this one.

MyPos = InstrRev(SearchString, SearchChar, -1, 1)

is the syntax I find on a VBScript forum.....can't get the settings just right for MacroScript....

Any help?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Oct 11, 2006 2:47 am

What are you trying to do? Why not use Pos> ? If you want the position counted from the end of the string then you can subtract the result of Pos> from the result of Len>

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Wed Oct 11, 2006 2:15 pm

I am trying to find the last occurrence a specific character within a string.

InstRev is built for that. I know I could do all sorts of string manipulations to get the result, but I like to use the most efficient method whenever possible.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Oct 11, 2006 2:39 pm

VBSTART
VBEND
VBEval>InStrRev("hello world","r"),lastRPos
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Wed Oct 11, 2006 3:05 pm

I had exactly that syntax in a "work" area of my program....problem was I was not stepping through the VBStart VBEnd lines, therefore my InstrRev wouldn't work.....duh!

always something simple I miss.

thanks, Marcus.

(maybe give a warning if VBE or VBR is used without VBStart, VBEnd?)...

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Oct 11, 2006 3:42 pm

SkunkWorks wrote:I am trying to find the last occurrence a specific character within a string.
Helps to know :)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts