Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If i enter jan or january i need to get 1. How to do it?
Posted
Comments
gettgotcha 9-Jan-14 15:31pm    
Did you tried anything? The answer is in your question only, it's just simple switch or if condition.
Tega Natufe 9-Jan-14 15:35pm    
Yeah, a switch statement would be good.

String month = "January";
int monthNumber;

switch(month) {
case "January":
monthNumber = 1;
break;
default:
break;
}

1 solution

 
Share this answer
 
Comments
CPallini 9-Jan-14 18:02pm    
5.
Maciej Los 10-Jan-14 1:51am    
Thank you, Carlo ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900