CronExpressionDescriptor.ExpressionDescriptor.GetDayOfMonthDescription C# (CSharp) Method

GetDayOfMonthDescription() protected method

Generates a description for only the DAYOFMONTH portion of the expression
protected GetDayOfMonthDescription ( ) : string
return string
        protected string GetDayOfMonthDescription()
        {
            string description = null;
            string expression = m_expressionParts[3];

            switch (expression)
            {
                case "L":
                    description = CronExpressionDescriptor.Resources.ComaOnTheLastDayOfTheMonth;
                    break;
                case "WL":
                case "LW":
                    description = CronExpressionDescriptor.Resources.ComaOnTheLastWeekdayOfTheMonth;
                    break;
                default:
                    Regex regex = new Regex("(\\d{1,2}W)|(W\\d{1,2})");
                    if (regex.IsMatch(expression))
                    {
                        Match m = regex.Match(expression);
                        int dayNumber = Int32.Parse(m.Value.Replace("W", ""));

                        string dayString = dayNumber == 1 ? CronExpressionDescriptor.Resources.FirstWeekday :
                            String.Format(CronExpressionDescriptor.Resources.WeekdayNearestDayX0, dayNumber);
                        description = String.Format(CronExpressionDescriptor.Resources.ComaOnTheX0OfTheMonth, dayString);

                        break;
                    }
                    else
                    {
                        description = GetSegmentDescription(expression,
                            CronExpressionDescriptor.Resources.ComaEveryDay,
                            (s => s),
                            (s => s == "1" ? CronExpressionDescriptor.Resources.ComaEveryDay :
                                CronExpressionDescriptor.Resources.ComaEveryX0Days),
                            (s => CronExpressionDescriptor.Resources.ComaBetweenDayX0AndX1OfTheMonth),
                            (s => CronExpressionDescriptor.Resources.ComaOnDayX0OfTheMonth));
                        break;
                    }
            }

            return description;
        }