dcsimg
equalIgnoresCase method??
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, March 16, 2002 01:37 PM

How do I get equalsIgnoreCase method to work with a switch statement?? //How/where would I implement equalsIgnoreCase in my example??// //String choice = "A"; //If(choice.equalsIgnoreCase("a"));//Like this?? switch(payMent) { case 'A': case 'B': //etc..... break; default: System.out.println("Invalid entry!"); }    More>>

How do I get equalsIgnoreCase method to work with a switch statement??




//How/where would I implement


equalsIgnoreCase in my example??//


//String choice = "A";



//If(choice.equalsIgnoreCase("a"));//Like this??




switch(payMent)


{

case 'A':


case 'B': //etc.....
break;


default:

System.out.println("Invalid entry!");


}

   <<Less

Re: equalIgnoresCase method??

Posted By:   Anonymous  
Posted On:   Sunday, March 17, 2002 08:11 AM

I'm not sure you can use it inside a switch statement, but you can do something like this:

switch {

case 'A':
case 'a':
// handle this...
break;

case 'B':
case 'b':
// handle this...
break;

// ... and so on

default:
// ...
}

Regards
About | Sitemap | Contact