• Post Reply Bookmark Topic Watch Topic
  • New Topic

need a better way to get months out of a string  RSS feed

 
Nadine Hossam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to extact Months names out of a given string, I can do it easily using regular expressions

something like:
Pattern.compile(january|february|.....).matcher("22January")

so that I can get the month's name found in this string but I need more professional code for doing so, I mean these months must be defined in the Date class but i dont know how to reach to them
any ideas?
 
Jeffrey Spaulding
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at DateFormat and SimpleDateFormat

http://www.javaalmanac.com/egs/java.text/FormatDate.html

J.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!