Extracting Filename extension

  • Thread starter Thread starter lepernet
  • Start date Start date
L

lepernet

Guest
I was sure that I saw a function for extracting the extension from a filename. Alas having pulled all my hair out trying to find it in the documentation I now throw myself on your mercy.

Ok ... what is it ?
:(
 
Code:
position = InStrRev(Text1.Text, ".")
Text2.Text = Right(Text1.Text, Len(Text1.Text) -  position + 1)

Im nearly sure it works like this. It even works if you have 10000 + . in the filename
 
Divil is right. If you want to use the cool new .NET framework
methods and classes, go for using the IO.Path class. Its also
much easier than the above.

The method to use is IO.Path.GetExtension()
 
Back
Top