how to get the file Extension name but without the "."?
io.path.getextension returns with the "."
Printable View
how to get the file Extension name but without the "."?
io.path.getextension returns with the "."
Why not just use the substring function to remove the "."?
Code:Dim MyPath As String = "c:\SomeFolder\Readme.txt"
Dim Extension As String = IO.Path.GetExtension(MyPath)
Extension = Extension.Substring(1, Extension.Length - 1)
Code:Dim MyPath As String = "c:\SomeFolder\Readme.txt"
Dim Extension As String = IO.Path.GetExtension(MyPath).Remove(0, 1)
Yet another way :D
Code:Dim MyPath As String = "c:\SomeFolder\Readme.txt"
Dim Extension As String = IO.Path.GetExtension(MyPath).Replace(".", "")
Replace is more inefficient because it searches the whole 4-character extension.
Yeah I think dbasnett's example is the best way to go, I was just point out another way it could be done :)
thanks for the quick reply guys.. + for you all