Re: Re. third-party dependencies [was Re: Stock Quotes using AppleScript]
Re: Re. third-party dependencies [was Re: Stock Quotes using AppleScript]
- Subject: Re: Re. third-party dependencies [was Re: Stock Quotes using AppleScript]
- From: KOENIG Yvan <email@hidden>
- Date: Mon, 16 Mar 2009 18:58:19 +0100
Completing your code to treat the complete set of MacRoman characters
with upper/lower is really easy.
The only problem is that you must recognize that you wrote something
wrong.
<script>
property lowRoman : {"œ", "æ", "á", "à", "â", "ä", "ã", "å", "é",
"è", "ê", "ë", "ó", "ò", "ô", "ö", "õ", "ú", "ù", "û", "ü", "í", "ì",
"î", "ï", "ñ", "ç", "ø", "ÿ", "π"}
property upRoman : {"Œ", "Æ", "Á", "À", "Â", "�Ä", "Ã", "Å", "É",
"È", "Ê", "Ë", "Ó", "Ò", "Ô", "Ö", "Õ", "Ú", "Ù", "Û", "Ü", "Í", "Ì",
"Î", "Ï", "Ñ", "Ç", "Ø", "Ÿ", "∏"}
on upper_case(theString) --> string
local newString
local c, a, i (* added *)
set newString to ""
repeat with c in characters of theString
set c to contents of c
set a to ASCII number of c
if a > 96 and a < 123 then
set a to a - 32
set newString to newString & (ASCII character a)
else if c is in my lowRoman then
repeat with i from 1 to count of my lowRoman
if c is item i of my lowRoman then
set newString to newString & item i of my upRoman
exit repeat
end if
end repeat
else
set newString to newString & c
end if
end repeat
set theString to newString
end upper_case
on lower_case(theString) --> string
local newString (* added *)
local c, a, i (* added *)
set newString to ""
repeat with c in characters of theString
set c to contents of c
set a to ASCII number of c
if a > 64 and a < 91 then
set a to a + 32
set newString to newString & (ASCII character a)
else if c is in my upRoman then
repeat with i from 1 to count of my upRoman
if c is item i of my upRoman then
set newString to newString & item i of my lowRoman
exit repeat
end if
end repeat
else
set newString to newString & c
end if
end repeat
set theString to newString
end lower_case
return {my upper_case("Kœnig"), my lower_case("GÉNÉRAL KŒNIG")}
<script>
I was not asking for a routine able to convert every Unicode which
may be converted.
Just for a routine matching what you wrote: (The file is MacOS Roman
encoding.)
Yvan KOENIG (from FRANCE lundi 16 mars 2009 18:47:39)
_______________________________________________
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