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


C# CharPtr.dec方法代码示例

本文整理汇总了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)
//.........这里部分代码省略.........
开发者ID:GSharpDevs,项目名称:RunG,代码行数:101,代码来源:loslib.cs


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