Re: Init Caps Handler
Re: Init Caps Handler
- Subject: Re: Init Caps Handler
- From: Skeeve <email@hidden>
- Date: Tue, 20 Nov 2007 22:25:50 +0100
Oakley Masten wrote:
Instead of trying to reinvent the wheel: I thought I
would ask first.
Is there an existing handler that takes a text
variable and reconfigures it to "Initial Capitals" for
every word?
While I'm at it how about "All Caps" and "No Caps"?
Not existing but an easy one:
on InitialCaps for a_text
do shell script "perl <<-'" & (ASCII character 3) & "'
while (<DATA>) {
print(ucfirst $_) foreach split /\\b/;
}
__DATA__" & (ASCII character 10) & a_text
end InitialCaps
on AllCaps for a_text
do shell script "perl <<-'" & (ASCII character 3) & "'
while (<DATA>) {
print uc $_;
}
__DATA__" & (ASCII character 10) & a_text
end AllCaps
on NoCaps for a_text
do shell script "perl <<-'" & (ASCII character 3) & "'
while (<DATA>) {
print lc $_;
}
__DATA__" & (ASCII character 10) & a_text
end NoCaps
NB: Requires perl and there is no ASCII Character 3 allowed in the text...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden