Re: Name rearrangement
Re: Name rearrangement
- Subject: Re: Name rearrangement
- From: Joseph Weaks <email@hidden>
- Date: Tue, 30 Mar 2004 02:43:49 -0600
On Mar 30, 2004, at 2:04 AM, Jim Witte wrote:
Hi,
What's a script that will take a name in the form of "STOOGE, CURLY"
and turn it into "Curly Stooge" This would be an absolute cinch in
PHP or Perl - but I'd rather not have to be calling out to the
Terminal to execute a Perl one-liner every time I want to do this..
For that matter, is there an OSAX to call Perl or PHP directly from
Applescript, without the overhead of the 'do script' command to
Terminal.
Jim Witte
Pattern matching with a 'do shell script' perl one liner is the
easiest, and can allow for the most variations. What overhead?
Here's a plain vanilla Applescript if Last and First are always
separated by comma and space:
set theName to "Stooge, Curly"
set otid to Applescript's Text Item Delimiters
set Applescript's Text Item Delimiters to ", "
set theName to text items of theName
set Applescript's Text Item Delimiters to otid
set theName to ((item 2 of theName) & " " & (item 1 of theName)) as
string
I was unsure if you meant to include changing case from all caps to
title caps. If so, look at the routine at
http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.07.htm
Cheers,
Joe Weaks
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.