Instead of toUpper
Mark Schonewille
m.schonewille at economy-x-talk.com
Sat Nov 29 16:47:15 EST 2008
Hi Ton,
This might be a little faster:
function xToUpper theText
put toUpper(theText) into theText
put "ÃÁÀÂÉÈÊËÍÎÏÌÑÓÒÔÖÕÚÙÛÜÇÅØÆŒ" into spCap
put "äáàâéèêëíîïìñóòôöõúùûüçåøæœ" into spSma
put 0 into myCounter
repeat for each char myChar in spSma
add 1 to myCounter
replace char myCounter of spSma with char myCounter of spCap in
theText
end repeat
return theText
end xToUpper
I am surprised that I have never seen the problems you describe, even
though I've been writing French texts on my Dutch Macs with
International English keyboards. Where does my script stop working for
you?
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum
Color Converter has been updated! Get it at
http://colorconverter.economy-x-talk.com !
On 29 nov 2008, at 21:51, Melitón Cardona Torres wrote:
> 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
More information about the use-livecode
mailing list