All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
正则表达式中的组集合的使用_.net资料_编程技术

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/13 9:43:49 Browse times: 332 Comment times: 0

正则表达式中的组集合的使用_.net资料_编程技术


Head photo

Go homepage
Upload pictures
Write articles

正则表达式中的组集合的使用_.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);






There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.