Beispiel #1
0
        /// <summary>
        /// 对字符串中的数字进行自增 鄢国平 2012-11-26
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string GetStringIdentify(string str)
        {
            int    Lenght  = str.Length;
            string strName = "" + str;// +str;

            for (int i = Lenght - 1; i >= 0; i--)
            {
                if (YKPageValidate.IsDecimal(str.Substring(i, 1)))
                {
                    int Number = Convert.ToInt32(str.Substring(i, 1)) + 1;
                    if (Number <= 9)
                    {
                        strName = strName.Remove(i, 1);
                        strName = strName.Insert(i, Number.ToString());
                        break;
                    }
                    else
                    {
                        strName = strName.Remove(i, 1);
                        strName = strName.Insert(i, "0");
                        if (i == 0)
                        {
                            strName = strName.Insert(i, "1");
                            break;
                        }
                    }
                }
            }
            return(strName);
        }
Beispiel #2
0
 /// <summary>
 /// 格式化日期字符串
 /// </summary>
 /// <param name="beginDay">开始日期字符串</param>
 /// <param name="endDay">结束日期字符串</param>
 /// <returns>正常日期年月日</returns>
 public static string[] FormatDateString(string beginDay, string endDay)
 {
     string[] day = new string[2];
     day[0] = "";
     day[1] = "";
     if (beginDay != "" || endDay != "")
     {
         if (YKPageValidate.IsDateTime(beginDay))
         {
             beginDay = beginDay + " 0:00:00";
         }
         if (YKPageValidate.IsDateTime(endDay))
         {
             endDay = endDay + " 23:59";
         }
         day[0] = beginDay;
         day[1] = endDay;
     }
     return(day);
 }