当前位置: 首页>>代码示例>>C#>>正文


C# DateTimeFormatInfo.GetAbbreviatedMonthName方法代码示例

本文整理汇总了C#中System.Globalization.DateTimeFormatInfo.GetAbbreviatedMonthName方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeFormatInfo.GetAbbreviatedMonthName方法的具体用法?C# DateTimeFormatInfo.GetAbbreviatedMonthName怎么用?C# DateTimeFormatInfo.GetAbbreviatedMonthName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Globalization.DateTimeFormatInfo的用法示例。


在下文中一共展示了DateTimeFormatInfo.GetAbbreviatedMonthName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public JObject Get(int year)
        {
            //DO DO: egt the month from the query string
            DateTimeFormatInfo dtfi = new DateTimeFormatInfo();

            JObject result = new JObject(
                new JProperty("bikes",
                    new JArray(Bike.getBikes().OrderBy(b => b.name).Select(b => JObject.FromObject(b)))),

                new JProperty("riders",
                    new JArray(Rider.getRiders().OrderBy(r => r.name).Select(r => JObject.FromObject(r)))),

                new JProperty("routes",
                    new JArray(Route.getRoutes().OrderBy(r => r.name).Select(r => JObject.FromObject(r)))),

                new JProperty("rides",
                    new JArray(Ride.getRides().OrderByDescending(r => r.ride_date).Select(r => JObject.FromObject(new RideVM(r))))),

                new JProperty("payments",
                    new JArray(Payment.getPayments().OrderBy(p => p.paid_date).Select(p => p.toJObject()))),

                new JProperty("colorList", getChartColors()),

                new JProperty("months", Enumerable.Range(1, 12).Select(i => new JObject(
                    new JProperty("month", i), new JProperty("caption", dtfi.GetAbbreviatedMonthName(i))))),

                new JProperty("riderSummary", getRiderSummary(year))

            );

            App.BikesDebug.dumpToFile("model.json", result.ToString(Newtonsoft.Json.Formatting.Indented));

            return result;
        }
开发者ID:catflinger,项目名称:bikes,代码行数:34,代码来源:ModelController.cs

示例2: GetMonthName

        //
        //  FormatHebrewMonthName
        //
        //  Action: Return the Hebrew month name for the specified DateTime.
        //  Returns: The month name string for the specified DateTime.
        //  Arguments: 
        //        time   the time to format
        //        month  The month is the value of HebrewCalendar.GetMonth(time).         
        //        repeat Return abbreviated month name if repeat=3, or full month name if repeat=4
        //        dtfi    The DateTimeFormatInfo which uses the Hebrew calendars as its calendar.
        //  Exceptions: None.
        // 
        
        /* Note:
            If DTFI is using Hebrew calendar, GetMonthName()/GetAbbreviatedMonthName() will return month names like this:            
            1   Hebrew 1st Month
            2   Hebrew 2nd Month
            ..  ...
            6   Hebrew 6th Month
            7   Hebrew 6th Month II (used only in a leap year)
            8   Hebrew 7th Month
            9   Hebrew 8th Month
            10  Hebrew 9th Month
            11  Hebrew 10th Month
            12  Hebrew 11th Month
            13  Hebrew 12th Month

            Therefore, if we are in a regular year, we have to increment the month name if moth is greater or eqaul to 7.            
        */
        private static String FormatHebrewMonthName(DateTime time, int month, int repeatCount, DateTimeFormatInfo dtfi)
        {
            Contract.Assert(repeatCount != 3 || repeatCount != 4, "repeateCount should be 3 or 4");
            if (dtfi.Calendar.IsLeapYear(dtfi.Calendar.GetYear(time))) {
                // This month is in a leap year
                return (dtfi.internalGetMonthName(month, MonthNameStyles.LeapYear, (repeatCount == 3)));
            }
            // This is in a regular year.
            if (month >= 7) {
                month++;
            }
            if (repeatCount == 3) {
                return (dtfi.GetAbbreviatedMonthName(month));
            }
            return (dtfi.GetMonthName(month));
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:45,代码来源:DateTimeFormat.cs

示例3: FormatMonth

 private static String FormatMonth(int month, int repeatCount, DateTimeFormatInfo dtfi)
 {
     Contract.Assert(month >=1 && month <= 12, "month >=1 && month <= 12");
     if (repeatCount == 3)
     {
         return (dtfi.GetAbbreviatedMonthName(month));
     }
     // Call GetMonthName() here, instead of accessing MonthNames property, because we don't
     // want a clone of MonthNames, which will hurt perf.
     return (dtfi.GetMonthName(month));
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:11,代码来源:DateTimeFormat.cs

示例4: BindControls

        private void BindControls()
        {
            List<CMEDTimeZone> timezones = controller.GetTimeZones();
            lstTimeZone.DataSource = timezones;
            lstTimeZone.DataTextField = "timezone_title";
            lstTimeZone.DataValueField = "timezone_code";
            lstTimeZone.DataBind();

            List<int> BDayNumbers = Enumerable.Range(1, 31).ToList();

            BDay.DataSource = BDayNumbers;
            BDay.DataBind();

            List<int> BMonthNumbers = Enumerable.Range(1, 12).ToList();

            BMonth.DataSource = BMonthNumbers;
            BMonth.DataBind();

            List<int> BYearNumbers = Enumerable.Range(1900, DateTime.Now.Year + 1 - 1900).ToList();

            BYear.DataSource = BYearNumbers;
            BYear.DataBind();

            List<int> BHourNumbers = Enumerable.Range(1, 12).ToList();

            foreach (int hour in BHourNumbers)
            {
                BHour.Items.Add(new ListItem(hour.ToString("00"), hour.ToString()));
            }

            DateTimeFormatInfo mfi = new DateTimeFormatInfo();
            foreach (int hour in BHourNumbers)
            {
                string strMonthName = mfi.GetAbbreviatedMonthName(hour);
                BeginDate.Items.Add(new ListItem(strMonthName, strMonthName));
            }

            List<int> BMinNumbers = Enumerable.Range(1, 59).ToList();
            foreach (int hour in BMinNumbers)
            {
                BMin.Items.Add(new ListItem(hour.ToString("00"), hour.ToString()));
            }

            AMPM.Items.Add(new ListItem("AM", "AM"));
            AMPM.Items.Add(new ListItem("PM", "PM"));

            Gender.Items.Add(new ListItem("Female", "Female"));
            Gender.Items.Add(new ListItem("Male", "Male"));
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:49,代码来源:CalWin.aspx.cs

示例5: GetMonthName

        /// <summary>
        /// Gets the abbreviated or full month name for the specified <paramref name="month"/> and <paramref name="year"/> value, using the
        /// <paramref name="nameProvider"/> if not null or the <see cref="DateTimeFormatInfo"/> specified by <paramref name="info"/>.
        /// </summary>
        /// <param name="month">
        /// The month value to get the month name for.
        /// </param>
        /// <param name="year">
        /// The year value to get the month name for.
        /// </param>
        /// <param name="info">
        /// The <see cref="DateTimeFormatInfo"/> value to use.
        /// </param>
        /// <param name="nameProvider">
        /// The <see cref="ICustomFormatProvider"/> to get the name. This parameter has precedence before the
        /// <paramref name="info"/>. Can be <c>null</c>.
        /// </param>
        /// <param name="abbreviated">
        /// true to get the abbreviated month name; false otherwise.
        /// </param>
        /// <returns>
        /// The full or abbreviated month name specified by <paramref name="month"/> and <paramref name="year"/>.
        /// </returns>
        private static string GetMonthName(int month, int year, DateTimeFormatInfo info, ICustomFormatProvider nameProvider, bool abbreviated)
        {
            if (nameProvider != null)
            {
                return abbreviated ? nameProvider.GetAbbreviatedMonthName(year, month) : nameProvider.GetMonthName(year, month);
            }

            return abbreviated ? info.GetAbbreviatedMonthName(month) : info.GetMonthName(month);
        }
开发者ID:tu-tran,项目名称:FareLiz,代码行数:32,代码来源:MonthCalendarDate.cs

示例6: GetMonthName

 public static string GetMonthName(int Month)
 {
     DateTimeFormatInfo dfi = new DateTimeFormatInfo();
     string monthName = dfi.GetAbbreviatedMonthName(Month);           
     return monthName;
 }
开发者ID:joyhui,项目名称:NuGet.Services.Dashboard,代码行数:6,代码来源:UnixTimeStampUtility.cs

示例7: ToString


//.........这里部分代码省略.........
						if (offset.Ticks >= 0)
							result.Append ('+');
						else
							result.Append ('-');
						result.Append (Math.Abs (offset.Hours).ToString ("00"));
						result.Append (':');
						result.Append (Math.Abs (offset.Minutes).ToString ("00"));
					} else if (dt.Kind == DateTimeKind.Utc)
						result.Append ('Z');
					break;
				//
				// Date tokens
				//
				case 'd':
					// day. d(d?) = day of month (leading 0 if two d's)
					// ddd = three leter day of week
					// dddd+ full day-of-week
					tokLen = DateTimeUtils.CountRepeat (format, i, ch);

					if (tokLen <= 2)
						DateTimeUtils.ZeroPad (result, dfi.Calendar.GetDayOfMonth (dt), tokLen == 1 ? 1 : 2);
					else if (tokLen == 3)
						result.Append (dfi.GetAbbreviatedDayName (dfi.Calendar.GetDayOfWeek (dt)));
					else
						result.Append (dfi.GetDayName (dfi.Calendar.GetDayOfWeek (dt)));

					break;
				case 'M':
					// Month.m(m?) = month # (with leading 0 if two mm)
					// mmm = 3 letter name
					// mmmm+ = full name
					tokLen = DateTimeUtils.CountRepeat (format, i, ch);
					int month = dfi.Calendar.GetMonth(dt);
					if (tokLen <= 2)
						DateTimeUtils.ZeroPad (result, month, tokLen);
					else if (tokLen == 3)
						result.Append (dfi.GetAbbreviatedMonthName (month));
					else
						result.Append (dfi.GetMonthName (month));

					break;
				case 'y':
					// Year. y(y?) = two digit year, with leading 0 if yy
					// yyy+ full year with leading zeros if needed.
					tokLen = DateTimeUtils.CountRepeat (format, i, ch);

					if (tokLen <= 2)
						DateTimeUtils.ZeroPad (result, dfi.Calendar.GetYear (dt) % 100, tokLen);
					else
						DateTimeUtils.ZeroPad (result, dfi.Calendar.GetYear (dt), tokLen);
					break;

				case 'g':
					// Era name
					tokLen = DateTimeUtils.CountRepeat (format, i, ch);
					result.Append (dfi.GetEraName (dfi.Calendar.GetEra (dt)));
					break;

				//
				// Other
				//
				case ':':
					result.Append (dfi.TimeSeparator);
					tokLen = 1;
					break;
				case '/':
					result.Append (dfi.DateSeparator);
					tokLen = 1;
					break;
				case '\'': case '"':
					tokLen = DateTimeUtils.ParseQuotedString (format, i, result);
					break;
				case '%':
					if (i >= format.Length - 1)
						throw new FormatException ("% at end of date time string");
					if (format [i + 1] == '%')
						throw new FormatException ("%% in date string");

					// Look for the next char
					tokLen = 1;
					break;
				case '\\':
					// C-Style escape
					if (i >= format.Length - 1)
						throw new FormatException ("\\ at end of date time string");

					result.Append (format [i + 1]);
					tokLen = 2;

					break;
				default:
					// catch all
					result.Append (ch);
					tokLen = 1;
					break;
				}
				i += tokLen;
			}
			return result.ToString ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:101,代码来源:DateTimeUtils.cs

示例8: MatchAbbreviatedMonthName

        /*=================================MatchAbbreviatedMonthName==================================
        **Action: Parse the abbreviated month name from string starting at str.Index.
        **Returns: A value from 1 to 12 for the first month to the twelveth month.
        **Arguments:    str: a __DTString.  The parsing will start from the
        **              next character after str.Index.
        **Exceptions: FormatException if an abbreviated month name can not be found.
        ==============================================================================*/

        private static bool MatchAbbreviatedMonthName(__DTString str, DateTimeFormatInfo dtfi, bool isThrowExp, ref int result) {
            int maxMatchStrLen = 0;
            result = -1;
            if (str.GetNext()) {
                //
                // Scan the month names (note that some calendars has 13 months) and find
                // the matching month name which has the max string length.
                // We need to do this because some cultures (e.g. "cs-CZ") which have
                // abbreviated month names with the same prefix.
                //            
                int monthsInYear = (dtfi.GetMonthName(13).Length == 0 ? 12: 13);
                for (int i = 1; i <= monthsInYear; i++) {
                    String searchStr = dtfi.GetAbbreviatedMonthName(i);
                    if (str.MatchSpecifiedWord(searchStr)) {
                        int matchStrLen = searchStr.Length;
                        if (matchStrLen > maxMatchStrLen) {
                            maxMatchStrLen = matchStrLen;
                            result = i;
                        }
                    }
                }
            }
            if (result > 0) {
                str.Index += (maxMatchStrLen - 1);
                return (true);
            }
            return (ParseFormatError(isThrowExp, "Format_BadDateTime"));            
        }
开发者ID:ArildF,项目名称:masters,代码行数:36,代码来源:datetimeparse.cs

示例9: createtable

    public void createtable(int month, int year)
    {
        System.Globalization.DateTimeFormatInfo forb = new System.Globalization.DateTimeFormatInfo();
        DataTable roomtab = getroomtable();

        int Year = DateTime.Now.Year;                                           //
        int Month = DateTime.Now.Month;                                         //Getting no of days in the month displayed so to create columns
        int today = Convert.ToInt16(DateTime.Today.ToString("dd"));
        int noofdays = System.DateTime.DaysInMonth(year, month);                //

        DataTable dt = new DataTable();                                         // temporary datatables for creating gridview   dt for maingridview
        DataTable dt1 = new DataTable();                                        // dt1 for Header

        int nofofroom1 = roomtab.Rows.Count;                                    //

        dt.Columns.Add("RoomNo  :");                                            //Adding first column Head
        dt1.Columns.Add("RoomNo  :");
        for (int i = 1; i <= noofdays; i++)
        {

            String mnth = ddlMonth.SelectedItem.Text;
            DateTime frmdate = Convert.ToDateTime(i.ToString()+"/" + mnth + "/" + year);
            var x = frmdate.ToString("MMM dd");
            string[] word = x.Split(' ');

            dt.Columns.Add(word[0] + "    " + word[1]);                          //Adding other column head
            dt1.Columns.Add(word[0] + "    " + word[1]);

        }

        int cntbed = 0;
        for (int j = 1; j <= nofofroom1; j++)                                     //Adding room nos. in first column
        {
            DataRow rw = dt.NewRow();
            rw["RoomNo  :"] = roomtab.Rows[j - 1].ItemArray[1] ;
            dt.Rows.Add(rw);
            cntbed++;
            if (Convert.ToInt16(roomtab.Rows[j - 1].ItemArray[3]) == 2)
            {
                DataRow rw1 = dt.NewRow();
                rw1["RoomNo  :"] = roomtab.Rows[j - 1].ItemArray[1] + ": 2nd ";
                dt.Rows.Add(rw1);
                cntbed++;

            }

            dt.AcceptChanges();
        }

        DataRow rw2 = dt1.NewRow();                                               //Adding a row into a grid view with header
           // rw2["RoomNo  :"] = "AluminiumnSQ";                                        // to adjust the width of header
        dt1.Rows.Add(rw2);
        dt1.AcceptChanges();
        GridView2.DataSource =dt1;                                                //
        GridView2.DataBind();                                                     //binding the data to griview with header

        GridView2.Rows[0].Style.Add("opacity", "0");                              // Hiding the row of the gridview with header

        GridView1.DataSource = dt;                                                //
        GridView1.DataBind();                                                     // Binding the main gridview with rooms nos.

        for (int i = 0; i <= noofdays; i++)                                       // Aligning header cells
        {
            GridView2.HeaderRow.Cells[i].Style.Add("text-align", "center");

        }

        for (int j = 0; j < cntbed; j++)
        {
            GridView1.Rows[j].Cells[0].Style.Add("background-color", "#22cc99");
            GridView1.Rows[j].Cells[0].Style.Add("border", "4px groove #fff");
            GridView1.Rows[j].Cells[0].Style.Add("text-align", "center");
            GridView1.Rows[j].Cells[0].Style.Add("width", "100px");
            GridView1.Rows[j].Style.Add("height", "50px");

            if (month == Month && year == Year)
            {
                GridView1.Rows[j].Cells[today].Style.Add("background-color", "#33FF99");        //for highlighting today
                GridView2.HeaderRow.Cells[today].Style.Add("background-color", "#33FF99");
                GridView2.HeaderRow.Cells[today].Style.Add("color", "black");
            }
        }

        if (!IsPostBack)
        {
            listpopulate(dt);                                                         //populate list in panel1  only for service provider access
        }
        getdata();                                                                // Getting the booking log in the main gridview
        if (month == 12)
        {
            forlab.InnerText = forb.GetAbbreviatedMonthName(1).ToString();
            backlab.InnerText = forb.GetAbbreviatedMonthName(month - 1).ToString();
        }
        else if (month == 1)
        {
            backlab.InnerText = forb.GetAbbreviatedMonthName(12).ToString();
            forlab.InnerText = forb.GetAbbreviatedMonthName(month + 1).ToString();
        }
        else
        {
//.........这里部分代码省略.........
开发者ID:KeshavPatil,项目名称:vedanta,代码行数:101,代码来源:Dasboard.aspx.cs

示例10: GetUserHistory

        private void GetUserHistory(ref CPDatabase database, DateTime current, ref DateTimeFormatInfo mfi, ref Dictionary<string, object> statistics)
        {
            // Get first day of month
            DateTime firstDay = new DateTime(current.Year, current.Month, 1);
            DateTime lastDay = new DateTime(current.Year, current.Month, DateTime.DaysInMonth(current.Year, current.Month));

            var users = new int();
            if (current.Year == DateTime.Today.Year && current.Month == DateTime.Today.Month)
            {
                // If we are doing todays month then we just count the total amount of users
                users = (from u in database.Users
                         select u).Count();
            }
            else
            {
                // Otherwise we are on other months and we need to look at statistics
                users = (from u in database.Stats_UserCount
                             where u.StatDate >= firstDay
                             where u.StatDate <= lastDay
                             orderby u.StatDate ascending
                             select u.UserCount).FirstOrDefault();
            }

            if (users < 1)
            {
                // If this is the very first point and it was null then we need to set it to zero so it will populate the whole graph
                if (firstDay < DateTime.Now.AddMonths(-11))
                    statistics.Add(string.Format("{0} {1}", mfi.GetAbbreviatedMonthName(current.Month), current.Year), 0);
                else
                    statistics.Add(string.Format("{0} {1}", mfi.GetAbbreviatedMonthName(current.Month), current.Year), null);
            }
            else
                statistics.Add(string.Format("{0} {1}", mfi.GetAbbreviatedMonthName(current.Month), current.Year), users);
        }
开发者ID:blinds52,项目名称:CloudPanel,代码行数:34,代码来源:DashboardViewModel.cs

示例11: FormatMonth

 private static string FormatMonth(int month, int repeatCount, DateTimeFormatInfo dtfi)
 {
     if (repeatCount == 3)
     {
         return dtfi.GetAbbreviatedMonthName(month);
     }
     return dtfi.GetMonthName(month);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DateTimeFormat.cs

示例12: FormatHebrewMonthName

 private static string FormatHebrewMonthName(DateTime time, int month, int repeatCount, DateTimeFormatInfo dtfi)
 {
     if (dtfi.Calendar.IsLeapYear(dtfi.Calendar.GetYear(time)))
     {
         return dtfi.internalGetMonthName(month, MonthNameStyles.LeapYear, repeatCount == 3);
     }
     if (month >= 7)
     {
         month++;
     }
     if (repeatCount == 3)
     {
         return dtfi.GetAbbreviatedMonthName(month);
     }
     return dtfi.GetMonthName(month);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:DateTimeFormat.cs

示例13: ShowMonthNameInfo

 // ----------------------------------------------------------------------
 public void ShowMonthNameInfo( DateTimeFormatInfo info, int month )
 {
     Console.WriteLine( "Current month name: " + info.GetMonthName( month ) );
     Console.WriteLine( "Current abbreviated month name: " + info.GetAbbreviatedMonthName( month ) );
     Console.WriteLine( "Current month index: " + info.MonthNames, info.GetMonthName( month ) );
 }
开发者ID:jwg4,项目名称:date-difference,代码行数:7,代码来源:CommunitySamples.cs

示例14: GetMonthNumber

        //
        // Check the word at the current index to see if it matches a month name.
        // Return -1 if a match is not found. Otherwise, a value from 1 to 12 is returned.
        //
        private static int GetMonthNumber(__DTString str, DateTimeFormatInfo dtfi)
        {
            //
            // Check the month name specified in dtfi.
            //
            int i;

            int monthInYear = (dtfi.GetMonthName(13).Length == 0 ? 12 : 13);
            int maxLen = 0;
            int result = -1;
            int index;
            String word = str.PeekCurrentWord();

            //
            // We have to match the month name with the longest length, 
            // since there are cultures which have more than one month names
            // with the same prefix.
            //
            for (i = 1; i <= monthInYear; i++) {
                String monthName = dtfi.GetMonthName(i);

                if ((index = str.CompareInfo.IndexOf(
                    word, monthName, CompareOptions.IgnoreCase)) >= 0) {
                    // This condition allows us to parse the month name for:
                    // 1. the general cases like "yyyy MMMM dd".
                    // 2. prefix in the month name like: "dd '\x05d1'MMMM yyyy" (Hebrew - Israel)
                    result = i;
                    maxLen = index + monthName.Length;
                } else if (str.StartsWith(monthName, true)) {
                    // The condition allows us to get the month name for cultures
                    // which has spaces in their month names.
                    // E.g. 
                    if (monthName.Length > maxLen) {
                        result = i;
                        maxLen = monthName.Length;
                    }
                }
                }
            if (result > -1) {
                str.Index += maxLen;
                return (result);
            }
            for (i = 1; i <= monthInYear; i++)
            {
                if (MatchWord(str, dtfi.GetAbbreviatedMonthName(i), false))
                {
                    return (i);
                }
            }

            //
            // Check the month name in the invariant culture.
            //
            for (i = 1; i <= 12; i++)
            {
                if (MatchWord(str, invariantInfo.GetMonthName(i), false))
                {
                    return (i);
                }
            }

            for (i = 1; i <= 12; i++)
            {
                if (MatchWord(str, invariantInfo.GetAbbreviatedMonthName(i), false))
                {
                    return (i);
                }
            }

            return (-1);
        }
开发者ID:ArildF,项目名称:masters,代码行数:75,代码来源:datetimeparse.cs

示例15: MatchAbbreviatedMonthName

        /*=================================MatchAbbreviatedMonthName==================================
        **Action: Parse the abbreviated month name from string starting at str.Index.
        **Returns: A value from 1 to 12 for the first month to the twelveth month.
        **Arguments:    str: a __DTString.  The parsing will start from the
        **              next character after str.Index.
        **Exceptions: FormatException if an abbreviated month name can not be found.
        ==============================================================================*/

        private static bool MatchAbbreviatedMonthName(ref __DTString str, DateTimeFormatInfo dtfi, ref int result) {
            int maxMatchStrLen = 0;
            result = -1;
            if (str.GetNext()) {
                //
                // Scan the month names (note that some calendars has 13 months) and find
                // the matching month name which has the max string length.
                // We need to do this because some cultures (e.g. "cs-CZ") which have
                // abbreviated month names with the same prefix.
                //
                int monthsInYear = (dtfi.GetMonthName(13).Length == 0 ? 12: 13);
                for (int i = 1; i <= monthsInYear; i++) {
                    String searchStr = dtfi.GetAbbreviatedMonthName(i);
                    int matchStrLen = searchStr.Length;
                    if ( dtfi.HasSpacesInMonthNames
                            ? str.MatchSpecifiedWords(searchStr, false, ref matchStrLen)
                            : str.MatchSpecifiedWord(searchStr)) {
                        if (matchStrLen > maxMatchStrLen) {
                            maxMatchStrLen = matchStrLen;
                            result = i;
                        }
                    }
                }

                // Search leap year form.
                if ((dtfi.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0) {
                    int tempResult = str.MatchLongestWords(dtfi.internalGetLeapYearMonthNames(), ref maxMatchStrLen);
                    // We found a longer match in the leap year month name.  Use this as the result.
                    // The result from MatchLongestWords is 0 ~ length of word array.
                    // So we increment the result by one to become the month value.
                    if (tempResult >= 0) {
                        result = tempResult + 1;
                    }
                }


            }
            if (result > 0) {
                str.Index += (maxMatchStrLen - 1);
                return (true);
            }
            return false;
        }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:51,代码来源:DateTimeParse.cs


注:本文中的System.Globalization.DateTimeFormatInfo.GetAbbreviatedMonthName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。