Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 new to java Need help!
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
deltag




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Hikaru79




PostPosted: Wed Nov 24, 2004 5:40 pm   Post subject: (No 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
deltag




PostPosted: 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
Hikaru79




PostPosted: Wed Nov 24, 2004 5:59 pm   Post subject: (No 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
deltag




PostPosted: Wed Nov 24, 2004 6:03 pm   Post subject: (No subject)

thanx apriciate your help
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: