I want to change a String so that all the uppercase characters become lowercase, and all the lower case characters become uppercase. Number characters are just ignored.
I do realize that the given thread is very old, but there is a better way of solving it:
class Toggle
{
public static void main()
{
String str = "This is a String";
String t = "";
for (int x = 0; x < str.length(); x++)
{
char c = str.charAt(x);
boolean check = Character.isUpperCase(c);
if (check == true)
t = t + Character.toLowerCase(c);
else
t = t + Character.toUpperCase(c);
}
System.out.println (t);
}
}