MACSCRPT Archives

January 2011

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type:
text/plain; charset="us-ascii"
Date:
Thu, 20 Jan 2011 14:54:16 +0000
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
Subject:
From:
Mark Lively <[log in to unmask]>
MIME-Version:
1.0
In-Reply-To:
Content-Transfer-Encoding:
quoted-printable
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Parts/Attachments:
text/plain (27 lines)
On Jan 20, 2011, at 9:41 AM, Claudio Braga wrote:

> Il giorno 20/gen/2011, alle ore 15.33, Mark J. Reed ha scritto:
> 
>> 
>> 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.
>> 
> 
> I guess this will not work for a file with multiple "." in the name. I'll stick with the previous solution

Actually it does rather well.

set aString to "this.   is..a.test"
set text item delimiters to "."
set outstring to text items 1 through -2 of aString as text
--"this.   is..a."

The only problem is the case where there is no period in the string.

-Mark
dot dot dot

ATOM RSS1 RSS2