Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get filetype / file extension
#1
i just wonder:

getfilename extracts the filename part from file.
s.getfilename([file] [ext])

is there a qm function which returns the [ext] ?
pi
#2
this is what i use:

(shortcut drop example)
Quick Macros :: View topic - macro shortcut syntax

qm_desktop_icon
Code:
Copy      Help
function $files

str ext.get(_command findcr(_command '.')+1)
str name.getfilename(_command)
str name_ext.getfilename(_command 1)
sel ext
,case "ini"
,,out "make some %s stuff with %s " ext name_ext
,,
,case else end
pi
#3
Member function str.GetFileExt

Code:
Copy      Help
function [$pathname]

;Gets filename extension.
;pathname - file name with or without path. Default: itself.


;EXAMPLE
;str s
;s.GetFileExt("c:\aaa\fff.eee")
;out s



if(!pathname) pathname=this

int i=findcr(pathname '\')+1
int j=findcr(pathname '.')+1
if(j>i) this.get(pathname j); this.trim("''")
else this=""


Forum Jump:


Users browsing this thread: 1 Guest(s)