Here you can find the source of getMonth(String strDate)
public static String getMonth(String strDate)
//package com.java2s; /**/*from w ww.j av a2 s. c o m*/ * * Methods Descrip:Converts a line of text into an array of lower case words * using a BreakIterator.wordInstance(). * <p> * * This method is under the Jive Open Source Software License and was * written by Mark Imbriaco. * * @param text * a String of text to convert into an array of words * @return text broken up into an array of words. * */ public class Main { public static String getMonth(String strDate) { String month = ""; if (strDate != null && !strDate.equals("")) { strDate = strDate.trim(); month = getElement(strDate.split("-"), 1); } if (!month.equals("") && month.length() > 1) { if (month.substring(0, 1).equals("0")) { month = month.substring(1, month.length()); } } return month; } private static String getElement(String[] strs, int number) { String elemenet = ""; if (strs != null) { int length = strs.length; if (number > length) { elemenet = strs[length]; } else { elemenet = strs[number]; } } return elemenet; } }