本文整理汇总了C#中KopiLua.CharPtr.dec方法的典型用法代码示例。如果您正苦于以下问题:C# CharPtr.dec方法的具体用法?C# CharPtr.dec怎么用?C# CharPtr.dec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KopiLua.CharPtr
的用法示例。
在下文中一共展示了CharPtr.dec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StrFTimeFmt
private static CharPtr StrFTimeFmt(CharPtr baseFormat, DateTime t, CharPtr pt, CharPtr ptlim)
{
CharPtr format = new CharPtr(baseFormat);
for (; format[0] != 0; format.inc())
{
if (format == '%')
{
format.inc();
if (format == 'E')
{
format.inc(); // Alternate Era is ignored
}
else if (format == 'O')
{
format.inc(); // Alternate numeric symbols is ignored
}
switch (format[0])
{
case '\0':
format.dec();
break;
case 'A': // Full day of week
//pt = _add((t->tm_wday < 0 || t->tm_wday > 6) ? "?" : _days[t->tm_wday], pt, ptlim);
pt = StrFTimeAdd(t.ToString("dddd"), pt, ptlim);
continue;
case 'a': // Abbreviated day of week
//pt = _add((t->tm_wday < 0 || t->tm_wday > 6) ? "?" : _days_abbrev[t->tm_wday], pt, ptlim);
pt = StrFTimeAdd(t.ToString("ddd"), pt, ptlim);
continue;
case 'B': // Full month name
//pt = _add((t->tm_mon < 0 || t->tm_mon > 11) ? "?" : _months[t->tm_mon], pt, ptlim);
pt = StrFTimeAdd(t.ToString("MMMM"), pt, ptlim);
continue;
case 'b': // Abbreviated month name
case 'h': // Abbreviated month name
//pt = _add((t->tm_mon < 0 || t->tm_mon > 11) ? "?" : _months_abbrev[t->tm_mon], pt, ptlim);
pt = StrFTimeAdd(t.ToString("MMM"), pt, ptlim);
continue;
case 'C': // First two digits of year (a.k.a. Year divided by 100 and truncated to integer (00-99))
//pt = _conv((t->tm_year + TM_YEAR_BASE) / 100, "%02d", pt, ptlim);
pt = StrFTimeAdd(t.ToString("yyyy").Substring(0, 2), pt, ptlim);
continue;
case 'c': // Abbreviated date/time representation (e.g. Thu Aug 23 14:55:02 2001)
pt = StrFTimeFmt("%a %b %e %H:%M:%S %Y", t, pt, ptlim);
continue;
case 'D': // Short MM/DD/YY date
pt = StrFTimeFmt("%m/%d/%y", t, pt, ptlim);
continue;
case 'd': // Day of the month, zero-padded (01-31)
//pt = _conv(t->tm_mday, "%02d", pt, ptlim);
pt = StrFTimeAdd(t.ToString("dd"), pt, ptlim);
continue;
case 'e': // Day of the month, space-padded ( 1-31)
//pt = _conv(t->tm_mday, "%2d", pt, ptlim);
pt = StrFTimeAdd(t.Day.ToString().PadLeft(2, ' '), pt, ptlim);
continue;
case 'F': // Short YYYY-MM-DD date
pt = StrFTimeFmt("%Y-%m-%d", t, pt, ptlim);
continue;
case 'H': // Hour in 24h format (00-23)
//pt = _conv(t->tm_hour, "%02d", pt, ptlim);
pt = StrFTimeAdd(t.ToString("HH"), pt, ptlim);
continue;
case 'I': // Hour in 12h format (01-12)
//pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, "%02d", pt, ptlim);
pt = StrFTimeAdd(t.ToString("hh"), pt, ptlim);
continue;
case 'j': // Day of the year (001-366)
pt = StrFTimeAdd(t.DayOfYear.ToString().PadLeft(3, ' '), pt, ptlim);
continue;
case 'k': // (Non-standard) // Hours in 24h format, space-padded ( 1-23)
//pt = _conv(t->tm_hour, "%2d", pt, ptlim);
pt = StrFTimeAdd(t.ToString("%H").PadLeft(2, ' '), pt, ptlim);
continue;
case 'l': // (Non-standard) // Hours in 12h format, space-padded ( 1-12)
//pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, "%2d", pt, ptlim);
pt = StrFTimeAdd(t.ToString("%h").PadLeft(2, ' '), pt, ptlim);
continue;
case 'M': // Minute (00-59)
//.........这里部分代码省略.........