本文整理汇总了C#中System.__DTString.FindEndOfCurrentWord方法的典型用法代码示例。如果您正苦于以下问题:C# __DTString.FindEndOfCurrentWord方法的具体用法?C# __DTString.FindEndOfCurrentWord怎么用?C# __DTString.FindEndOfCurrentWord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.__DTString
的用法示例。
在下文中一共展示了__DTString.FindEndOfCurrentWord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDayOfWeekNumber
//
// Check the word at the current index to see if it matches a day of week name.
// Return -1 if a match is not found. Otherwise, a value from 0 to 6 is returned.
//
private static int GetDayOfWeekNumber(__DTString str, DateTimeFormatInfo dtfi) {
//
// Check the month name specified in dtfi.
//
DayOfWeek i;
int maxLen = 0;
int result = -1;
//
// We have to match the day name with the longest length,
// since there are cultures which have more than one day of week names
// with the same prefix.
//
int endIndex = str.FindEndOfCurrentWord();
String dayName=null;
for (i = DayOfWeek.Sunday; i <= DayOfWeek.Saturday; i++) {
dayName = dtfi.GetDayName(i);
if (str.MatchSpecifiedWord(dayName, endIndex)) {
if (dayName.Length > maxLen) {
result = (int)i;
maxLen = dayName.Length;
}
}
}
if (result > -1) {
str.Index = endIndex;
return (result);
}
for (i = DayOfWeek.Sunday; i <= DayOfWeek.Saturday; i++)
{
if (MatchWord(str, dtfi.GetAbbreviatedDayName(i), false))
{
return ((int)i);
}
}
//
// Check the month name in the invariant culture.
//
for (i = DayOfWeek.Sunday; i <= DayOfWeek.Saturday; i++)
{
if (MatchWord(str, invariantInfo.GetDayName(i), false))
{
return ((int)i);
}
}
for (i = DayOfWeek.Sunday; i <= DayOfWeek.Saturday; i++)
{
if (MatchWord(str, invariantInfo.GetAbbreviatedDayName(i), false))
{
return ((int)i);
}
}
return (-1);
}