How can I parse a String and return an Enum value in Apex Code?
This isn't generic, but it would work:
String dayOfWeekNameToMatch = 'Wednesday';
DayOfWeek dayOfWeekMatch;
for (DayOfWeek dow: DayOfWeek.values()) {
if (dow.name() == dayOfWeekNameToMatch) {
dayOfWeekMatch = dow;
break;
}
}