VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Gets the file extention of a file name up to 1 million characters long.

by Tom Parkison (8 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th April 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Gets the file extention of a file name up to 1 million characters long.

Rate Gets the file extention of a file name up to 1 million characters long.



  Dim i As Long
  For i = 2 To 1000000
    If Left(Right(FileName, i), 1) = "." Then
      If WithDot = True Then
        FileExtention = Right(FileName, i)
        Else
        FileExtention = Right(FileName, i - 1)
      End If
      Exit Function
    End If
  Next
End Function

---=== How to Use ===---

' To get the file extention with the dot at the left
variable = FileExtention(FILENAME, True)

' To get the file extention without the dot at the left
variable = FileExtention(FILENAME, False)

Download this snippet    Add to My Saved Code

Gets the file extention of a file name up to 1 million characters long. Comments

No comments have been posted about Gets the file extention of a file name up to 1 million characters long.. Why not be the first to post a comment about Gets the file extention of a file name up to 1 million characters long..

Post your comment

Subject:
Message:
0/1000 characters