Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)aaa
published in(发表于) 2013/12/13 9:43:49
正则表达式中的组集合的使用_.net资料_编程技术

正则表达式中的组集合的使用_.net资料_编程技术-你的首页-uuhomepage.com

简单实例:


string s = "2005-2-21";
Regex reg = new Regex(@"(?\d{4})-(?\d{1,2})-(?\d{1,2})",RegexOptions.Compiled);

Match match = reg.Match(s);
int year = int.Parse(match.Groups["y"].Value);
int month = int.Parse(match.Groups["m"].Value);
int day = int .Parse(match.Groups["d"].Value);
DateTime time = new DateTime(year,month,day);







If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759