Re: RegExps in AS
Re: RegExps in AS
- Subject: Re: RegExps in AS
- From: Nigel Smith <email@hidden>
- Date: Tue, 22 Feb 2005 13:13:13 +0000
On 20/2/05 17:35, "Ihar 'Philips' Filipau" <email@hidden> wrote:
> How do you people do in AS simple things like: strip extension (if
> file has one), strip directories from path name (if there anything to
> strip), extract extension (if name has one), extract path name (if name
> has one), etc.
A lot of this depends on how you are presenting the input -- whether if is a
file reference, a text list of Apple- or Unix-style paths, and so on. As
others have said, you need to say more about what you are trying to do.
In the meantime, and just to show there are many ways to skin this
particular cat, here's a way to get "filename-without-extension":
set theFile to (choose file)
set tmp to (reverse of (every character of (get name of (info for
theFile)))) as text
return (reverse of every character of (get text ((offset of
"." in tmp) + 1) thru -1 of tmp)) as text
Hey -- I never said it was a *good* way :-)
Nigel
_______________________________________________
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
References: | |
| >RegExps in AS (From: "Ihar 'Philips' Filipau" <email@hidden>) |