by Agam Saran (5 Submissions)
Category: String Manipulation
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
Do you use different functions to extract Filename, Filepath, or Extension from a path. GetPath is a function that can extract 9 different parts from a path. It can extract FileName, JustName, FileExtension, FilePath, Drive, LastFolder, FirstFolder, LastFolderAndFileName and DriveAndFirstFolder. It supports relative paths too. Try to parse "C:\Look\At\The\FileExtension\Of\This\Path.exe\" to your GetExtension function and then it to my GetPath function. Also try "C:\Temp\Is\A\File\Not\A\Folder\Temp". You will know the difference. I will feel glad to hear your comments and suggestions.
Inputs
Path, from what to extract, and PathType, what to extract
Code Returns
The desired extraction
Download GetPath (10 KB)