BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"File Name Functions"
, by poedboy
3 Functions to extract the: pathname, extension, and actual name of a given filename string. Returns a string.
Code
;**************************************** ; File Name Functions ; ; by the Pissed Off Boy ; 4:36am 6/26/02 ; ; ================================== ; ; 1. FILE_GetExt$(filename$) ; 2. FILE_GetPath$(filename$) ; 3. FILE_GetName$(filename$) ; ; (The functions are self explanatory ;) ) ; ;**************************************** Function FILE_GetExt$(filename$) Local l,count For l=Len(filename$) To 1 Step -1 count=count+1 If Mid(filename$,l,1)="." Return Right(filename$,count) EndIf Next End Function Function FILE_GetPath$(filename$) Local l For l=Len(filename$) To 1 Step -1 If Mid(filename$,l,1)="\" Return Left(filename$,l) EndIf Next End Function Function FILE_GetName$(filename$) Local l,count=Len(filename$) For l=count To 1 Step -1 If Mid(filename$,l,1)="." filename$=Left(filename$,l-1) count=Len(filename$) Exit EndIf Next For l=count To 1 Step -1 If Mid(filename$,l,1)="\" Return Right(filename$,count-l) EndIf Next Return filename$ End Function
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations