capitalizing text items


Eggplant seems to be chock full of time-saving routines, but I can’t seem to find one for changing the case of a text item. Has anyone come up with a straight-forward way to change the case of a text item?

I could of course write a function that does this, but I thought I’d first try to tap into the Eggplant community and see if I couldn’t save myself a bit of time (and perhaps learn something).

Thanks in advance.

  • Chris D.

And of course just as I post this, I come across the entry in the manual for how to do this… I will say that it was rather hard to find though.

Moderators, please feel free to delete this post. I don’t seem able to do it myself.

  • Chris D.

Since you brought it up, we might as well let people know that the functions are called toUpper() and toLower() – in case anyone else is looking, too!

Just for fun, here’s an example that capitalizes the first character of every word in some text:

set text to "eggplant is really amazing"
repeat with each word of text by reference
	set the first character of it to toUpper(the first character of it)
end repeat
put text
--> Eggplant Is Really Amazing