Switch statement with Strings

skania

New member
Joined
Jul 12, 2013
Messages
2
Programming Experience
1-3
I've got a prompt where the user will enter a selection of options. Right now, I'm using an if/else if/else statement, but was wanting to switch to a switch statement. The problem is, I want to be able to make it case insensitive. I know I can do this with an if/else if/else using str.Equals("", StringComparison.OrdinalIgnoreCase). Is there any way I can ignore cases so I can use a switch statement?
 

skania

New member
Joined
Jul 12, 2013
Messages
2
Programming Experience
1-3
I solved it. I did:

C#:
switch (str.ToLower())
 
Top Bottom