|
-
Sep 24th, 2000, 05:10 PM
#1
Thread Starter
Lively Member
I if have a variable that contains a path of a file(Ex: "C:\New Folder\blah.ini") how can i take that and get rid of the path, making it just "blah.ini"?
Any help is appreciated! Thank yoU!
-
Sep 24th, 2000, 05:23 PM
#2
_______
<?>
Code:
Option Explicit
Private Sub Command1_Click()
' A text comparison starting at #1 position looking for \
Dim SearchString, SearchChar, MyPos
SearchString = "C:\New Folder\blah.ini" ' String to search in.
SearchChar = "\" ' Search for "\".
Dim i As Integer
For i = 1 To Len(SearchString)
MyPos = InStr(1, SearchString, SearchChar, 1)
'if found MyPos will be > 0
If MyPos > 0 Then
SearchString = Right(SearchString, Len(SearchString) - MyPos)
End If
Next i
MsgBox SearchString
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 24th, 2000, 05:36 PM
#3
Thread Starter
Lively Member
I just found a much much simplier way:
Code:
#!/usr/bin/perl
'in module
Public Function FileName(FilePath as String)
FileName = Left(FilePath, Len(FilePath) - InStrRev(FilePath, "\"))
End Function
That returns the filename, much simplier and faster. Thanks anyway!
[Edited by Xero on 09-24-2000 at 06:38 PM]
-
Sep 24th, 2000, 05:42 PM
#4
Thread Starter
Lively Member
nevermind, it doesnt work =).
-
Sep 24th, 2000, 05:42 PM
#5
_______
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 24th, 2000, 05:43 PM
#6
Thread Starter
Lively Member
Oh! To fix it replace Left with Right, silly me .
-
Sep 24th, 2000, 05:45 PM
#7
_______
<?>
already did that...
thanks...I'll add it to my mdb
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|