fromStringEN method

Weekday fromStringEN (String input)

Converts an English string into a Weekday (case-insensetive). Errors if given day of week is not valid.

Implementation

static Weekday fromStringEN(String input) {
  switch (input.toLowerCase()) {
    case 'monday':
      return Weekday.Monday;
      break;

    case 'tuesday':
      return Weekday.Tuesday;
      break;

    case 'wednesday':
      return Weekday.Wednesday;
      break;

    case 'thursday':
      return Weekday.Thursday;
      break;

    case 'friday':
      return Weekday.Friday;
      break;

    default:
      throw 'Invalid day of week!';
  }
}