Subject: | |
From: | |
Reply To: | |
Date: | Thu, 20 Jan 2011 09:33:34 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Thu, Jan 20, 2011 at 9:18 AM, Claudio Braga <[log in to unmask]> wrote:
>> tell (info for someFile)
>> set {theName, theExtension} to {name, name extension}
>> end
>> set bareName to text 1 through -(length of theExtension + 2) of theName
>
> Yes , I like this solution, it looks much more elegant to me than checking backwards until the first . is found, trimming etc.
To be fair, a TID-based solution is short and not what I would call inelegant:
set text item delimiters to "."
set bareName to text items 1 through -2 of theName as text
The only flaw I see in this approach is that it doesn't elevate the
idea of "name extension" into an abstraction that sits above the idea
of "part of a string after a period". And I'm not sure how valuable
such an abstraction is anyway.
> Thank you, I think I'll just use this
Prego.
--
Mark J. Reed <[log in to unmask]>
|
|
|