中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

一些格式的Java工具類

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
    public class FormatTools {  
        /** 
         * 判斷郵箱 
         *  
         * @param email 
         * @return 
         */  
        public static boolean isEmail(String email) {  
            String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";  
            Pattern p = Pattern.compile(str);  
            Matcher m = p.matcher(email);  
      
            return m.matches();  
        }  
      
        // 判斷手機號  
        public static boolean IsPhoneNum(String mobiles) {  
            if (mobiles.trim().length() == 11) {  
                Pattern p = Pattern  
                        .compile("^((13[0-9])|(15[^4,\\D])|(18[0,2,5-9]))\\d{8}$");  
                Matcher m = p.matcher(mobiles);  
                Log.d("IsPhoneNum", m.matches() + "");  
                return m.matches();  
            }  
            return false;  
      
        }  
      
        // 判斷座機  
        public static boolean IsCallNum(String mobiles) {  
            boolean isValid = false;  
            CharSequence inputStr = mobiles;  
            Pattern pattern = Pattern.compile("^(0\\d{2,3})(\\d{7,8})(\\d{3,})?$");  
            Matcher matcher = pattern.matcher(inputStr);  
            if (matcher.matches()) {  
                isValid = true;  
            }  
            return isValid;  
        }  
      
        // 判斷手機或座機  
        public static boolean IsAllCallNum(String mobiles) {  
            boolean isValid = false;  
            String expression = "(^((13[0-9])|(15[^4,\\D])|(18[0,2,5-9]))\\d{8}$)|"  
                    + "(^(0\\d{2,3})(\\d{7,8})(\\d{3,})?$)";  
            CharSequence inputStr = mobiles;  
            Pattern pattern = Pattern.compile(expression);  
            Matcher matcher = pattern.matcher(inputStr);  
            if (matcher.matches()) {  
                isValid = true;  
            }  
            return isValid;  
        }  
      
        // 判斷字符串是數(shù)字  
        public static boolean isNumeric(String str) {  
            for (int i = 0; i < str.length(); i++) {  
                // System.out.println(str.charAt(i));  
                if (!Character.isDigit(str.charAt(i))) {  
                    return false;  
                }  
            }  
            return true;  
        }  
      
        /** 
         * 判斷是否為整數(shù) 
         *  
         * @param str 傳入的字符串 
         *  
         * @return 是整數(shù)返回true,否則返回false 
         */  
      
        public static boolean isInteger(String str) {  
            Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");  
            return pattern.matcher(str).matches();  
        }  
      
        /** 
         * 判斷是否符合密碼規(guī)則 
         *  6-16為字母數(shù)字集合 不包含非法字符 
         * @param str 
         * @return 
         */  
        public static boolean isPwd(String str) {  
            Pattern pattern = Pattern.compile("^[a-z0-9A-Z]+$");  
            return pattern.matcher(str).matches();  
        }  
      
        /** 
         * 將秒轉(zhuǎn)換成小時分鐘 
         *  
         * @param second 
         * @return 
         */  
        public static String changeTotime(int second) {  
            int h = 0;  
            int d = 0;  
            int s = 0;  
            int temp = second % 3600;  
            if (second > 3600) {  
                h = second / 3600;  
                if (temp != 0) {  
                    if (temp > 60) {  
                        d = temp / 60;  
                        if (temp % 60 != 0) {  
                            s = temp % 60;  
                        }  
                    } else {  
                        s = temp;  
                    }  
                }  
            } else {  
                d = second / 60;  
                if (second % 60 != 0) {  
                    s = second % 60;  
                }  
            }  
      
            // return h + "小時" + d + "分鐘" + s + "秒";  
            return h + "小時" + d + "分鐘";  
        }  
      
        /** 
         * 米轉(zhuǎn)換成公里 
         *  
         * @return 
         */  
        public static String miToGl(int distance) {  
            double dis = Math.round(distance / 100d) / 10d;  
            return dis + "公里";  
        }  
    }  

標簽: isp

版權申明:本站文章部分自網(wǎng)絡,如有侵權,請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:上傳和下載Ftp服務器文件或文件夾

下一篇:Ftp與NFS服務器端上傳和下載