Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Nov 12, 2019 8:25 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: get extension of any file
PostPosted: Thu Dec 15, 2011 5:48 am 
Offline

Joined: Sun Apr 11, 2010 4:33 am
Posts: 102
Hello guys,
how can i get a extension o any file?

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: get extension of any file
PostPosted: Thu Dec 15, 2011 6:16 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Pick it from the folderitem.name property?

PS: We do have a plugin function folderitem.NameExtensionMBS to do this.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: get extension of any file
PostPosted: Thu Dec 15, 2011 7:23 am 
Offline
User avatar

Joined: Fri Jun 05, 2009 11:50 am
Posts: 348
Location: Hamburg, Germany
What about folderitem.type property ?

or you can use this function

Function getextension(file as string) As String
dim pos as integer=0
dim last as boolean = false
dim extension as string =""
dim oldfile as string=file

while not last
pos =InStr(file,".")
if pos > 0 then
oldfile = file
file = mid(file,pos+1)
else
last = true
end if
wend

pos =InStr(oldfile,".")

if pos >0 then
extension = mid(oldfile,pos+1,len(oldfile))
else
extension = ""
end if

return extension
End Function


call this function like

extension = getextension(file)

_________________
Best regards

Stefan

Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group