内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Java基于正則實(shí)現(xiàn)的日期校驗(yàn)功能示例-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)www.cdcxhl.cn八線動(dòng)態(tài)BGP香港云服務(wù)器提供商,新人活動(dòng)買多久送多久,劃算不套路!

江津ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書合作)期待與您的合作!

本文實(shí)例講述了Java基于正則實(shí)現(xiàn)的日期校驗(yàn)功能。分享給大家供大家參考,具體如下:

private void checkDate() throws IOException {
    // 4種分隔符
    String sep = "[-\\./_]";
    // 年份
    String strPattern = "^(19[4-9]\\d|20\\d{2})" + sep;
    strPattern += "(";
    // 月(1,3,5,7,8,10,12)
    strPattern += "((0?[13578]|1[02])" + sep + "(0?[1-9]|[12][0-9]|3[01]))|";
    // 月(4,6,9,11)
    strPattern += "((0?[469]|11)" + sep + "(0?[1-9]|[12][0-9]|30))|";
    // 月(2)
    strPattern += "((2)" + sep + "(0?[1-9]|[12]\\d))";
    strPattern += ")$";
    Pattern p = Pattern.compile(strPattern);
    Matcher m = p.matcher("");
    int count = 0;
    String fileName = ExcelGene.class.getResource("date.txt").getFile();
    BufferedReader br = new BufferedReader(new FileReader(fileName));
    String line = null;
    while ((line = br.readLine()) != null) {
      count++;
      if (line.trim().length() > 0) {
        m.reset(line);
        if (!m.find()) {
          System.out.println(count + " " + line);
        } else {
          String year = m.group(1);
          String month = m.group(4);
          month = month == null ? m.group(7) : month;
          month = month == null ? m.group(10) : month;
          String date = m.group(5);
          date = date == null ? m.group(8) : date;
          date = date == null ? m.group(11) : date;
          System.out.println(year + "年" + month + "月" + date + "日");
        }
      }
    }
}

分享文章:Java基于正則實(shí)現(xiàn)的日期校驗(yàn)功能示例-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://www.rwnh.cn/article30/csodso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、域名注冊(cè)小程序開發(fā)、商城網(wǎng)站網(wǎng)站設(shè)計(jì)、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

營(yíng)銷型網(wǎng)站建設(shè)
十堰市| 红河县| 昭平县| 花莲县| 万州区| 义乌市| 金乡县| 镇赉县| 务川| 永康市| 定安县| 遂川县| 隆尧县| 邯郸市| 宜城市| 收藏| 贵港市| 同心县| 四子王旗| 抚松县| 武乡县| 施甸县| 五莲县| 襄垣县| 邹平县| 巢湖市| 邵阳县| 龙南县| 故城县| 红河县| 边坝县| 云浮市| 西和县| 彝良县| 商洛市| 铜陵市| 泗洪县| 侯马市| 奇台县| 临城县| 揭东县|