July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Often you need to work with pathnames, directory names, and filenames. The .NET Framework provides the System.IO.Path class, offering shared members that enable you to manipulate pathnames. For example, you might want to extract the filename from a pathname. This is accomplished by invoking the GetFileName method as follows:
'Returns "TextFile.txt"Dim fileName As String = Path.GetFileName("C:\TextFile.txt")
The GetExtension method returns instead only the file extension and is used as follows:
'Returns ".txt"Dim extension As String = Path.GetExtension("C:\TextFile.txt")
To ensure that a filename has an extension, you can also invoke the HasExtension method that ...