Welcome to Dream.In.Code
Become a Java Expert!

Join 149,950 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,334 people online right now. Registration is fast and FREE... Join Now!




accept both uppercase and lower case versions of a character

 
Reply to this topicStart new topic

accept both uppercase and lower case versions of a character

armani05
24 Sep, 2008 - 08:04 PM
Post #1

New D.I.C Head
*

Joined: 22 Sep, 2008
Posts: 5

Hi, new to it need some help with how to make the menu to accept both uppercase and lower case characters corresponding to the menu option.

any help would be much appreciated.
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Accept Both Uppercase And Lower Case Versions Of A Character
25 Sep, 2008 - 01:46 AM
Post #2

better than jam.
Group Icon

Joined: 6 Feb, 2008
Posts: 5,837



Thanked: 104 times
Dream Kudos: 2700
Expert In: slobbing.

My Contributions
Welcome to DIC!

Which language? (I need to know, so I can move this thread)
User is offlineProfile CardPM
+Quote Post

armani05
RE: Accept Both Uppercase And Lower Case Versions Of A Character
25 Sep, 2008 - 02:18 AM
Post #3

New D.I.C Head
*

Joined: 22 Sep, 2008
Posts: 5

QUOTE(gabehabe @ 25 Sep, 2008 - 02:46 AM) *

Welcome to DIC!

Which language? (I need to know, so I can move this thread)






Java, thanks
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Accept Both Uppercase And Lower Case Versions Of A Character
25 Sep, 2008 - 03:00 AM
Post #4

better than jam.
Group Icon

Joined: 6 Feb, 2008
Posts: 5,837



Thanked: 104 times
Dream Kudos: 2700
Expert In: slobbing.

My Contributions
Moved to Java then! smile.gif
User is offlineProfile CardPM
+Quote Post

AbuJaFaR
RE: Accept Both Uppercase And Lower Case Versions Of A Character
25 Sep, 2008 - 03:16 AM
Post #5

D.I.C Head
**

Joined: 13 Dec, 2007
Posts: 123


My Contributions
Hello there,
Why dont u make the choice with numbers tongue.gif

1)
2)
etc..


Or there is equalsignorecase i think.
User is offlineProfile CardPM
+Quote Post

AmitTheInfinity
RE: Accept Both Uppercase And Lower Case Versions Of A Character
25 Sep, 2008 - 03:24 AM
Post #6

C Surfing ∞
Group Icon

Joined: 25 Jan, 2007
Posts: 1,156



Thanked: 44 times
Dream Kudos: 125
My Contributions
you can go for switch also...

java

switch(character)
{
case 'a' : // fall through
case 'A' : callFunctionForCaseA();
break;
case 'b' : // fall through
case 'B' : callFunctionForCaseB();
break;
case 'c' : // fall through
case 'C' : callFunctionForCaseC();
break;
.
.
.
case 'z' : // fall through
case 'Z' : callFunctionForCaseZ();
break;
}


I hope this will help you. smile.gif
User is offlineProfile CardPM
+Quote Post

1lacca
RE: Accept Both Uppercase And Lower Case Versions Of A Character
25 Sep, 2008 - 04:57 AM
Post #7

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
or convert it to lowercase, than you only have to check it for equality with the lower-case letter.
User is offlineProfile CardPM
+Quote Post

markhazlett9
RE: Accept Both Uppercase And Lower Case Versions Of A Character
26 Sep, 2008 - 10:51 AM
Post #8

D.I.C Regular
***

Joined: 12 Jul, 2008
Posts: 280



Thanked: 10 times
My Contributions
you can also use character.toUpperCase
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 05:31PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month