By Daniel · January 11, 2009
Inverts the case of some string, making all the lowercase letters uppercase and vice-versa.
/* string_invert_case(str)
*
* Inverts the case of some string, making all the lowercase letters
* uppercase and vice-versa.
*/
var out, len, i, c, o;
out = '';
len = string_length(argument0);
for (i = 1; i <= len; i += 1) {
c = string_char_at(argument0, i);
o = ord(c);
if (o >= ord('a') && o <= ord('z'))
out += string_upper(c);
else
out += string_lower(c);
}
return out;
Categories: String handling
There are no comments to display.
You must be signed in to post comments.