zoukankan      html  css  js  c++  java
  • DateChooser 2007.07.25版

    修正日期分析的Bug
    Date.ParseExact()方法居然不能将2007/7/25这样的字符串用yyyy/MM/dd这样的格式符解析,而只能是2007/07/25,没办法,改成用正则表达式来分析了。
    2007.07.25版下载

    DUDU的版本管理器怎么用,在哪里?

                    Regex regDateFormat = new Regex(@"([ymd])\1{0,3}", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    MatchCollection formatMatches = regDateFormat.Matches(DateFormat);
                    Regex regDate = new Regex(@"\d+",RegexOptions.Compiled);
                    MatchCollection dateMatches = regDate.Matches(this._textBox.Text);
                    int year = 0;
                    int month = 0;
                    int day = 0;
                    for(int i = 0 ; i < formatMatches.Count ; i++)
                    {
                        Match match = formatMatches[i];
                        switch (match.Value[0])
                        {
                            case 'Y':
                            case 'y':
                                year = int.Parse(dateMatches[i].Value);
                                break;
                            case 'M':
                            case 'm':
                                month = int.Parse(dateMatches[i].Value);
                                break;
                            case 'D':
                            case 'd':
                                day = int.Parse(dateMatches[i].Value);
                                break;
                        }
                    }
                    return new DateTime(year, month, day);
  • 相关阅读:
    团队项目—第二次冲刺计划
    第一阶段冲刺总结
    团队绩效评估
    回复其他小组对我们的评价
    软件项目评价
    maven 之分模块构建web项目 及 聚合与继承特性
    Log4j 使用总结
    freemarker 总结
    freemarker入门 之 脱离容器实现hello word
    读取txt文件 统计“java”出现的次数(大小写不敏感)
  • 原文地址:https://www.cnblogs.com/think/p/830487.html
Copyright © 2011-2022 走看看