Guide Contents
|
DigitalDan Home Page
|
Dim s As String
s = IO.Path.GetDirectoryName("c:\path\myfile.txt")
' "c:\mypath"
s = IO.Path.GetFileNameWithoutExtension("c:\path\myfile.txt")
' "myfile"
s = IO.Path.GetExtension("c:\path\myfile.txt")
' ".txt"
s = IO.Path.GetFullPath("c:\path\myfile.txt")
' "c:\mypath\myfile.txt"
s = IO.Path.GetPathRoot("c:\path\myfile.txt")
' "c:\"
s = IO.Path.HasExtension("c:\path\myfile.txt").ToString
' True
The IO.Path.Get... are very reliable but the IO.Path.GetDirectoryName has an unuual quirk