Re: RegExps in AS
Re: RegExps in AS
- Subject: Re: RegExps in AS
- From: Barry Wainwright <email@hidden>
- Date: Sun, 20 Feb 2005 20:31:32 +0000
On 20/2/05 6:53 pm, "Christopher Stone" <email@hidden> wrote:
> For a more traditional AppleScript approach you can do something like this:
>
> ----------------------------------------------------------------------
>
> set fName to "someFileName.ext"
>
> if character -4 of fName = "." then
> set AppleScript's text item delimiters to {"."}
> set fName to (text items 1 thru -2 of fName) as string
> set AppleScript's text item delimiters to {""}
> fName
> end if
Since you're only checking for 3 character extensions here, why use the TIDs
at all?
if character -4 of fName = "." then set fname to text 1 thru -5 of fname
Better is to just use the tids to catch all extensions (there are sevral
popular 4 character extension, including .HTML, .PICT etc.
if "." is in fname then
set AppleScript's text item delimiters to {"."}
set fName to (text items 1 thru -2 of fName) as string
set AppleScript's text item delimiters to {""}
end if
--
Barry
_______________________________________________
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