Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-07-2004, 09:19 PM   PM User | #1
petela
New Coder

 
Join Date: Jan 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
petela is an unknown quantity at this point
finding last occurrence in a string

Hi,

I know how to find the first occurrence of a character in a string using the VB
InStr function. How do I find the last occurrence of a character in a string? Here is the string I want to manipulate:

C:\Inetpub\wwwroot\greatnorthwest\web door gallery\entry and exterior\Entry w French side litesThumb.jpg

I want to find the position of the last occurrence of "\" in the string, and then trim everything to the left of it so that I the string is reduced to:

Entry w French side litesThumb.jpg.

How would I go about accomplishing this task? I have many more of these strings to manipulate, all contiaining different numbers of the "\" character, so I need to be able to work from right to left.

Thanks,
petela
petela is offline   Reply With Quote
Old 12-08-2004, 02:28 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Use InStrRev() (Instr Reverse) function.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 12-08-2004, 04:00 PM   PM User | #3
petela
New Coder

 
Join Date: Jan 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
petela is an unknown quantity at this point
Thanks. That should work. I'll give it a try.
petela is offline   Reply With Quote
Old 12-08-2004, 05:19 PM   PM User | #4
petela
New Coder

 
Join Date: Jan 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
petela is an unknown quantity at this point
It works like a charm. Thanks again.

petela
petela is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:10 AM.


Advertisement
Log in to turn off these ads.