关于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.
阅读全文