Bruce,
instead of using a pure AppleScript function which does character-by-character translation (which will be slow), you might want to consider a mixed AppleScript/shell script variant - the
tr utility is pretty much what you are looking for...
The following script has three handlers which will convert to uppercase, lowercase, or change the case of each letter:
Click to open this script in your Script Editor
<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; padding: 0.2em; font-size: 10px; width:500px">set theString to "This is an example input string"
log upperCase(theString)
log lowerCase(theString)
log changeCase(theString)
on upperCase(theString)
do shell script "echo " & quoted form of theString & " | tr '[a-z]' '[A-Z]'"
end upperCase
on lowerCase(theString)
do shell script "echo " & quoted form of theString & " | tr '[A-Z]' '[a-z]'"
end lowerCase
on changeCase(theString)
do shell script "echo " & quoted form of theString & " | tr '[A-Za-z]' '[a-zA-Z]'"
end changeCase</pre>
Andreas
