I have the following if statement:
String newStr4 = strr.split(\"2012\")[0];
if (newStr4.startsWith(\"Mon\")) {
str4.add(newStr4);
}
I
Of course, be mindful that your program will only be useful in english speaking countries if you detect dates this way. You might want to consider:
Set dayNames = Calendar.getInstance()
.getDisplayNames(Calendar.DAY_OF_WEEK,
Calendar.SHORT,
Locale.getDefault())
.keySet();
From there you can use .startsWith or .matches or whatever other method that others have mentioned above. This way you get the default locale for the jvm. You could always pass in the locale (and maybe default it to the system locale if it's null) as well to be more robust.