Instead of toUpper
Melitón Cardona Torres
toncardona at mac.com
Sat Nov 29 08:33:09 EST 2008
Works fine on my mac; I wonder whether it be the same a PC. Any hints?
Thanks in advance,
Ton Cardona
function toCapitals aText
--Works on a mac environement
put "ÁÉÍÓÚÑÄËÏÖÜÂÊÎÔÛÇÆØŒÅ" into unusualCapitals
put "áéíóúñäëïöüâêîôûçæøœå" into unusualSmall
repeat with y= 1 to the length of aText
put char y of aText into aChar
put chartonum(aChar) into itsNumber
--Line feed
if itsNumber = 10 then
put cr after newWord
next repeat
end if
--Already capital
if itsNumber>64 and itsNumber<91 then
put aChar after newWord
next repeat
end if
-- Not capital without accent
if itsNumber >96 and itsNumber <123 then
put numtochar(itsNumber-32) after newWord
next repeat
end if
-- Foreseen unusual characters
if aChar is among the chars of unusualSmall then
put false into detected
repeat with g= 1 to 22
if char g of unusualSmall is aChar then
put char g of unusualCapitals after newWord
put true into detected
exit repeat
end if
end repeat
if detected then next repeat
end if
--Space, numbers and others
if ((itsNumber >31) and (itsNumber <65)) or ((itsNumber>90) and
(itsNumber<97)) then
put aChar after newWord
next repeat
end if
--Unforeseen unusual characters
if itsNumber>122 and aChar is not in unusualSmall then
put aChar after newWord
next repeat
end if
end repeat
return newWord
end toCapitals
More information about the use-livecode
mailing list