Instead of toUpper

Melitón Cardona Torres toncardona at mac.com
Sat Nov 29 15:51:01 EST 2008


function toCapitals aText
   put "ÃÁÀÂÉÈÊËÍÎÏÌÑÓÒÔÖÕÚÙÛÜÇÅØ" into spCap
   put "äáàâéèêëíîïìñóòôöõúùûüçåø" into spSma
   if chartonum(char 2 of aText)>64 and chartonum(last char of  
aText)<91 then
    ## No need to process, apparently
     return aText
   else
     put toUpper(aText) into upText
     repeat with x = 1 to the number of chars of upText
       put char x of upText into aChar
## Those characters (æ, œ) cannot be included in spSma (?)
       if chartonum(aChar) is 190 then
         replace aChar with numtochar(174) in upText
         next repeat
       end if
      if chartonum(aChar) is 207 then
         replace aChar with numtochar(207) in upText
         next repeat
       end if
## SpecChars
      if aChar is among the chars of spSma then
         repeat with y=1 to the number of chars of spSma
           if aChar is char y of spSma then
             replace char y of spSma with char y of spCap in upText
           end if
         end repeat
       end if
     end repeat
   end if
   return upText
end toCapitals

Based on Robert Brenstein's suggestions.


More information about the use-livecode mailing list