Here you can find the source of month2int(String month)
Parameter | Description |
---|---|
month | A given month as a String. |
public static int month2int(String month)
//package com.java2s; /*//from w w w. jav a2 s . co m This file is part of JFLICKS. JFLICKS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. JFLICKS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with JFLICKS. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Parse a String and determine if it is a month. If so then return an * int value where January = 0, February = 1, etc. * * @param month A given month as a String. * @return An int value representing the month. */ public static int month2int(String month) { int result = 0; if (month != null) { if (month.equalsIgnoreCase("january")) { result = 0; } else if (month.equalsIgnoreCase("february")) { result = 1; } else if (month.equalsIgnoreCase("march")) { result = 2; } else if (month.equalsIgnoreCase("april")) { result = 3; } else if (month.equalsIgnoreCase("may")) { result = 4; } else if (month.equalsIgnoreCase("june")) { result = 5; } else if (month.equalsIgnoreCase("july")) { result = 6; } else if (month.equalsIgnoreCase("august")) { result = 7; } else if (month.equalsIgnoreCase("september")) { result = 8; } else if (month.equalsIgnoreCase("october")) { result = 9; } else if (month.equalsIgnoreCase("november")) { result = 10; } else if (month.equalsIgnoreCase("december")) { result = 11; } } return (result); } }