private static bool MatchDayName(ref __DTString str, DateTimeFormatInfo dtfi, ref int result) {
// Turkish (tr-TR) got day names with the same prefix.
int maxMatchStrLen = 0;
result = -1;
if (str.GetNext()) {
for (DayOfWeek i = DayOfWeek.Sunday; i <= DayOfWeek.Saturday; i++) {
String searchStr = dtfi.GetDayName(i);
int matchStrLen = searchStr.Length;
if ( dtfi.HasSpacesInDayNames
? str.MatchSpecifiedWords(searchStr, false, ref matchStrLen)
: str.MatchSpecifiedWord(searchStr)) {
if (matchStrLen > maxMatchStrLen) {
maxMatchStrLen = matchStrLen;
result = (int)i;
}
}
}
}
if (result >= 0) {
str.Index += maxMatchStrLen - 1;
return (true);
}
return false;
}