Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ MatchMonthName()

static bool System.DateTimeParse.MatchMonthName ( ref __DTString str,
DateTimeFormatInfo dtfi,
ref int result )
inlinestaticprivate

Definition at line 2882 of file DateTimeParse.cs.

2883 {
2884 int maxMatchStrLen = 0;
2885 result = -1;
2886 if (str.GetNext())
2887 {
2888 int num = ((dtfi.GetMonthName(13).Length == 0) ? 12 : 13);
2889 for (int i = 1; i <= num; i++)
2890 {
2891 string monthName = dtfi.GetMonthName(i);
2892 int matchLength = monthName.Length;
2893 if ((dtfi.HasSpacesInMonthNames ? str.MatchSpecifiedWords(monthName, checkWordBoundary: false, ref matchLength) : str.MatchSpecifiedWord(monthName)) && matchLength > maxMatchStrLen)
2894 {
2895 maxMatchStrLen = matchLength;
2896 result = i;
2897 }
2898 }
2899 if ((dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0)
2900 {
2901 int num2 = str.MatchLongestWords(dtfi.MonthGenitiveNames, ref maxMatchStrLen);
2902 if (num2 >= 0)
2903 {
2904 result = num2 + 1;
2905 }
2906 }
2907 if ((dtfi.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0)
2908 {
2909 int num3 = str.MatchLongestWords(dtfi.InternalGetLeapYearMonthNames(), ref maxMatchStrLen);
2910 if (num3 >= 0)
2911 {
2912 result = num3 + 1;
2913 }
2914 }
2915 }
2916 if (result > 0)
2917 {
2918 str.Index += maxMatchStrLen - 1;
2919 return true;
2920 }
2921 return false;
2922 }

References System.str.

Referenced by System.DateTimeParse.ParseByFormat().