Searching characters from the right 
Author Message
 Searching characters from the right

I would like som help. I want to search for the last character (slash) in
a path from the right. For example C:/folder/folder/picture.jpg and then
write out picture.jpg

Thank you!!

--
Posted via CNET Help.com
http://www.*-*-*.com/



Sat, 07 Dec 2002 03:00:00 GMT  
 Searching characters from the right
Try this :

<script language="VBScript">
dim myArray

myString = "C:/folder/folder/folder/sub/pictures.jpg"

myArray = split(myString,"/")

msgbox myArray(ubound(myArray))

</script>

Cheers,
MD.

*****Please do not reply by e-mail*****


Quote:
> I would like som help. I want to search for the last character (slash) in
> a path from the right. For example C:/folder/folder/picture.jpg and then
> write out picture.jpg

> Thank you!!

> --
> Posted via CNET Help.com
> http://www.help.com/



Sat, 07 Dec 2002 03:00:00 GMT  
 Searching characters from the right
"Thomas Hall" wrote ...

Quote:
> I would like som help. I want to search for the last character (slash) in
> a path from the right. For example C:/folder/folder/picture.jpg and then
> write out picture.jpg

Mid( strPath, InstrRev( strPath, "/" ) + 1 )
[where strPath is the path you're searching]

hth hand

Adam



Sat, 07 Dec 2002 03:00:00 GMT  
 Searching characters from the right
That's what the InStrRev function is for, Thomas.  See the VBScript docs for
more details, but note that the syntax is different than for InStr.

    InStrRev(string1, string2[, start[, compare]])

                                        Chick
===================================================
Please remove the SPAMTHIS from my address for e-mail replies.

Quote:

>I would like som help. I want to search for the last character (slash) in
>a path from the right. For example C:/folder/folder/picture.jpg and then
>write out picture.jpg



Sun, 08 Dec 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. getting right 2 characters from a string

2. Extract certain characters from right

3. Character Searching

4. Character string search

5. VB character Search and Replace

6. search and replace characters in table

7. Search and Replace Between Characters - Newbie Question

8. Search/Replace Em Space/En Space characters

9. Search and replace, how to replace with special characters

10. Search & Replace Unicode Characters

11. Search a string and change a character if it exists in the string

12. Search/replace raised characters

 

 
Powered by phpBB® Forum Software