by Darkhacka (3 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sat 27th January 2001
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
This code gets the file name from a given path.
API Declarations
No declarations required for this code.
'This function gets the filename from a path
'PathString must include the filename in the whole path.
'Usage: StringName = NameFromPath(PathString)
Dim X As Integer, Ps As Integer, Tmp As String
Tmp = FilePath
For X = 1 To Len(Tmp)
Ps = InStr(1, Tmp, "\", vbTextCompare)
If Ps <> 0 Then
Tmp = Mid(Tmp, Ps + 1)
Else
End If
Next X
NameFromPath = Tmp
End Function