|
-
Jan 10th, 2010, 09:20 AM
#1
Thread Starter
Lively Member
[RESOLVED] Filename Extension
how to get the file Extension name but without the "."?
io.path.getextension returns with the "."
-
Jan 10th, 2010, 09:32 AM
#2
Re: Filename Extension
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)
-
Jan 10th, 2010, 09:58 AM
#3
Re: Filename Extension
Code:
Dim MyPath As String = "c:\SomeFolder\Readme.txt"
Dim Extension As String = IO.Path.GetExtension(MyPath).Remove(0, 1)
-
Jan 10th, 2010, 11:02 AM
#4
Re: Filename Extension
Yet another way 
Code:
Dim MyPath As String = "c:\SomeFolder\Readme.txt"
Dim Extension As String = IO.Path.GetExtension(MyPath).Replace(".", "")
-
Jan 10th, 2010, 11:09 AM
#5
Re: Filename Extension
Replace is more inefficient because it searches the whole 4-character extension.
-
Jan 10th, 2010, 11:10 AM
#6
Re: Filename Extension
Yeah I think dbasnett's example is the best way to go, I was just point out another way it could be done
-
Jan 10th, 2010, 11:16 AM
#7
Thread Starter
Lively Member
Re: Filename Extension
thanks for the quick reply guys.. + for you all
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|