|
-
Jul 30th, 2001, 12:44 PM
#1
Thread Starter
Lively Member
Quickie!
I am feeling like an idiot today but...
I have a string which holds the path:
C:\WINNT\Media\Windows Logon Sound.wav
I just wanna be able to chop off the file name and put it in a listbox. I am just being stupid today and can't think of the best way to do it, just a function to chop off anything after the last " \" and return it as its own string.
Zevlag
Josh -- Name
Zevlag13 -- AIM
www.WotsIt.org for all your file format spec questions!
-
Jul 30th, 2001, 12:46 PM
#2
Frenzied Member
dim a as integer
filenam = split (strpath, "\")
a = ubound (filenam)
filename = filenam (a)
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
-
Jul 30th, 2001, 12:47 PM
#3
Thread Starter
Lively Member
thanks, I totally spaced out the split function!
Zevlag
Josh -- Name
Zevlag13 -- AIM
www.WotsIt.org for all your file format spec questions!
-
Jul 30th, 2001, 12:52 PM
#4
PowerPoster
Another way if you want (VB5 friendly!):
VB Code:
Dim strFile As String
Dim strNew As String
Dim i As Long
strFile = Text1.Text
Do While Right(strFile, 1) <> "\"
strNew = strNew & Right(strFile, 1)
strFile = Left(strFile, Len(strFile) - 1)
Loop
strNew = StrReverse(strNew)
List1.AddItem strNew
-
Jul 30th, 2001, 12:52 PM
#5
Frenzied Member
yeah i understand, happens to me all the time. You may have to clean my code up a lil cuz i was too lazy to open up VB to check it.
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
-
Jul 30th, 2001, 12:55 PM
#6
Split is certainly one way to do it. Here's another
MyString = "C:\WINNT\Media\Windows Logon Sound.wav"
MsgBox Right$(MyString, Len(MyString) - (InStrRev(MyString, "\")))
-
Jul 30th, 2001, 12:57 PM
#7
Frenzied Member
yeah i think that split is the easiest way though, less code
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
-
Jul 30th, 2001, 12:58 PM
#8
Thread Starter
Lively Member
Oh, no big deal, it was just the function I was looking for! Just spaced me. Oh and thanks ChrisJK that looks like taht may work bettere anyways!
Zevlag
Josh -- Name
Zevlag13 -- AIM
www.WotsIt.org for all your file format spec questions!
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
|