Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java help (I know, I know java sux lol)

Name: Anonymous 2010-06-18 17:28

I'm trying to take a line in single character input and if it's uppercase, switch it to lower case and vice versa.
System.out.print ("Enter character: "); 
             s=stdin.readLine();
             c[i]=s.charAt(0);
             k=(int)c[i];
             if(k>96)
        {
                Character.toUpperCase(c[i]);
        }
             else
        {  
                Character.toLowerCase(c[i]);
        } 
             i++;
         }
         while(k!=46);

Everything else works right, but that doesn't flip it. HALP
<3

Name: Anonymous 2010-06-18 17:31

So in your mind, Character.toLowerCase magically knows that the single character you passed it is part of a String, and should actually find that particular String and perform the transformation in-place? I'd like to know how you arrived at this belief, because neither common sense nor the documentation support it.

No wonder you're using Java.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List