|
-
May 15th, 2000, 01:00 AM
#1
Thread Starter
Lively Member
How to I rip the file name from a full path string?
eg.
"c:\Folder\picture.jpg"
What I want is "picture.jpg". And the path of the picture
is different depending on the user selection. So, using
the mid() is somewhat impossible (or maybe not) because of varying length.
Thx
-
May 15th, 2000, 01:08 AM
#2
New Member
easy mate, just mundane code
just use a do while loop and test every charcter backwards untill you come across "\". You can do this with the mid(), then cut the string required using pointers (i%) for the number of characters required.
any probs send e-mail "[email protected]"
-
May 15th, 2000, 03:32 PM
#3
Fanatic Member
Give this a whirl
Code:
sMaskName = "c:\myFolder\AnotherFolder\MyFile.txt"
sTest = Dir$(sMaskName, vbNormal) 'loses the path!
Iain, thats with an i by the way!
-
May 15th, 2000, 03:54 PM
#4
Frenzied Member
Another alternative - vb6 only
Code:
Private Function getTitle(Filename As String) As String
Dim strTemp() As String
strTemp = Split(Filename, "\")
getTitle = strTemp(UBound(strTemp()))
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|