Computer Science Canada

new to java Need help!

Author:  deltag [ Wed Nov 24, 2004 5:28 pm ]
Post subject:  new to java Need help!

Can someone please tell me how to turn the user input into uppercase letters.
ex: hello <a user input
to
HELLO< the final output

thanx

Author:  Hikaru79 [ Wed Nov 24, 2004 5:40 pm ]
Post subject: 

This one's easy Smile There's a method of every String object called "toUpperCase". So if you wanted to turn a variable called 'userInput' to all caps, it would be:

code:
userInput = userInput.toUpperCase();


Hope that helps Smile

Author:  deltag [ Wed Nov 24, 2004 5:53 pm ]
Post subject:  Thanx this works

This works but the problem is that i need to use lenght() and charAt() to somehow get the user input to turn to uppercase. can you help me?

thanx again

Author:  Hikaru79 [ Wed Nov 24, 2004 5:59 pm ]
Post subject: 

Ooh. You're trying to write your OWN 'toUpperCase' method? Shoulda said so =) I'd help you, but this sounds awfully like a homework question Wink So instead, I'll post some psuedo-code to get you started. This will NOT compile.. it's just the program in regular english.

code:

for (length of the input (x)){
character (x) of the input becomes UpperCase
}


Easy, right? Smile

Author:  deltag [ Wed Nov 24, 2004 6:03 pm ]
Post subject: 

thanx apriciate your help


: