Hello.
I stole the char arrays from hubion’s addressbook scripts and made this function for you.
I’m emailing hubi and giving him the function to include in his library.
It should work pretty good at the American and Eurasian continents where unicode text are starting to be a standard. Although they might not be perfect, but still better than plain Ascii.
This function assumes it is fed one word at a time, it will report a whitespace character as a character that it can’t deduce the case from and return null.
property special_bigChars : {"Ä", "Ã…", "Ç", "É", "Ñ", "Ö", "Ü", "À", "Ã", "Õ", "Ÿ", "Â", "Ê", "Ã", "Ë", "È", "Ã", "ÃŽ", "Ã", "ÃŒ", "Ó", "Ô", "Ã’", "Ú", "Û", "Ù"} as text
property special_smallChars : {"ä", "Ã¥", "ç", "é", "ñ", "ö", "ü", "à ", "ã", "õ", "ÿ", "â", "ê", "á", "ë", "è", "Ã", "î", "ï", "ì", "ó", "ô", "ò", "ú", "û", "ù"} as text
log "" & isUC("FÃ…RIKÃ…L") -->true
on isUC(someText) -- or a string.
local theChars,thisChar,chrNum
set theChars to characters of someText
repeat with aChar in theChars
repeat
set thisChar to contents of aChar
set chrNum to (id of thisChar) -- thanks to Nigel Garvey.
if (chrNum is greater than 64) and (chrNum is less than 91) then
exit repeat -- vanilla uppercase
else if (chrNum is greater than 96 and chrNum is less than 123) then
return false -- vanilla lowercase
else if thisChar is in (my special_bigChars) then
exit repeat -- unicode uppercase
else if thisChar is in (my special_smallChars) then
return false -- unicode lowercase
else
return null -- when none of above.
end if
end repeat
end repeat
return true
end isUC
Best Regards
McUsr