C
CSharp
C++
Java
Visual Basic
HTML - CSS
Android
Asp
Asp.Net
Php
Python
JavaScript
SQL
XML
Assembly
ActiveX
API
Code Snippets
Database
Files Directories Drives
Forms
Graphics Games
Multimedia
Strings
Windows and Controls
More...
Visual Basic > Files Directories Drives sample source codes
Visual Basic Code > Removing Paths and Extensions
Removing Paths and Extensions Public Function StripPath(FileName As String, _ Optional Extension As Boolean) As Function 'Dimension some variables. Dim TMP As String Dim I As Long Dim FName As String FName = Filename 'Make sure there is a path to strip. If InStr(1, FName, "\") Then For I = 0 To 256 'Maximum filename length. TMP = Right$(FName, I) If Left$(TMP, 1) = "\" Then Exit For Next I FName = Right$(TMP, (I - 1)) End If 'Check whether we should remove extension. If Extension = True Then For I = 1 To 5 'Max. extension length + 1 to capture . TMP = Right$(FName, I) If Left$(TMP, 1) = "." Then Exit For Next I FName = Left$(FName, (Len(FName) - I)) End If StripPath = FName End Function
Privacy Policy
|
Contact
|
Advertising
|
Link to Us
|
Directory