Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


substrings

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,260
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> substrings
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 substrings - 7/10/2001 1:50:26 AM   
  israelda

 

Posts: 13
Score: 0
Joined: 5/23/2001
From: Israel
Status: offline
Hi

How do I find the last occurence of a charachter or symbol in a given
string:

ie. how would i find the position of the second "\" in the following
string?
"C:\stuff\pk_promo8_feb12_afternoon.txt"

Thanks,
 
 
Post #: 1
 
 Re: substrings - 7/10/2001 1:51:18 AM   
  drkesrel

 

Posts: 11
Score: 0
Joined: 5/23/2001
From: USA
Status: offline
Try the function InStrRev.

s = "C:\stuff\pk_promo8_feb12_afternoon.txt"

position = InStrRev(s,"\")

msgbox position

(in reply to israelda)
 
 
Post #: 2
 
 Re: substrings - 7/10/2001 1:52:14 AM   
  dougc

 

Posts: 12
Score: 0
Joined: 5/31/2001
From: USA
Status: offline
And from the other side:

test = "C:\stuff\pk_promo8_feb12_afternoon.txt"
nFirst = InStr(test, "\")
if nFirst<>0 then nSecond = InStr(nFirst+1, test, "\")
if nSecond<> 0 then Response.Write nSecond

(in reply to israelda)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> substrings Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts