Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB7
Expertise: beginner
Jun 8, 2002

ChangeFileExtension - Modify the extension in a file name

' Change the extension of a file name
' if the last argument is True, it adds the extension even if the file doesn't 
' have one

Function ChangeFileExtension(ByVal FileName As String, _
    ByVal Extension As String, Optional ByVal AddIfMissing As Boolean = False) _
    As String
    If AddIfMissing OrElse IO.Path.GetExtension(FileName).Length > 0 Then
        Return IO.Path.ChangeExtension(FileName, Extension)
    Else
        Return FileName
    End If
End Function
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap