随笔分类 -  C#

 
关于c#判断字符串是否日期
摘要:public bool IsValidDate(string strDate) { if(strDate.Length==0) return true; Regex r = new Regex("^([0-9]+)-([0-9]{1,2})-([0-9]{1,2})$"); Match m=r.Match(strDate); if(m.Success) { Group g=m.Groups[1]; int year=int.Parse(g.ToString()); //获得年 if(year< 1 || year>9999) return false; g=m. 阅读全文
posted @ 2011-07-10 12:46 等待轮回 阅读(4216) 评论(3) 推荐(1)