Re: What is the best way to get the name (without the extension) of a file?
Re: What is the best way to get the name (without the extension) of a file?
- Subject: Re: What is the best way to get the name (without the extension) of a file?
- From: kai <email@hidden>
- Date: Fri, 6 May 2005 17:09:58 +0100
On Friday, May 6, 2005, at 10:37 am, Nathan Day wrote:
how about
set fileName to "com.apple.iTunes.eq.plist"
if (offset of "." in fileName) > 0 then
set {theOldDelimieter, text item delimiters} to {text item
delimiters, "."}
set fileName to (text items 1 thru -2 of fileName) as string
set text item delimiters to theOldDelimieter
end if
fileName
You could squeeze more speed from this approach with a little tweaking.
This, for example, is about 7 times faster here:
set fileName to "com.apple.iTunes.eq.plist"
considering case
if "." is in fileName then
set d to text item delimiters
set text item delimiters to "."
set fileName to fileName's text 1 thru text item -2
set text item delimiters to d
end if
end considering
fileName
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden