zoukankan      html  css  js  c++  java
  • string时间转换为时间格式

    public string formatDataStr(string objstring)
            {
                if (objstring == "" || objstring == null || objstring == ".")
                {
                    return "";
                }
                else
                {
                    string tmpresultstr;
                    objstring = objstring.Replace(",", ".").Replace(",", ".").Replace(" ", "").Replace("/", ".").Replace("-", ".");
                    string[] objstringlist = objstring.Split('.');
                    if (objstringlist.Count() >= 1)
                    {
                        if (objstringlist[0].Trim().Length == 2)
                        {
                            tmpresultstr = "20" + objstringlist[0].Trim();
                        }
                        else
                        {
                            tmpresultstr = objstringlist[0].Trim();
                        }
                        for (int i = 1; i < objstringlist.Count(); i++)
                        {
                            if (objstringlist[i].Trim().Length == 1)
                            {
                                objstringlist[i] = "0" + objstringlist[i].Trim();
                            }
                            tmpresultstr = tmpresultstr + "." + objstringlist[i];
                        }
                        return tmpresultstr;
                    }
                    else
                    {
                        return objstring;
                    }
                }
            }

  • 相关阅读:
    hdu-2612-Find a way
    poj-1426-Find The Multiple
    POJ-2251-Dungeon Master
    树的遍历
    前序和中序+后序和中序
    哈夫曼树
    平衡二叉树
    队列和优先队列
    1213
    1163
  • 原文地址:https://www.cnblogs.com/wuchao/p/2693894.html
Copyright © 2011-2022 走看看