private boolean isValidNumber() { if (BeautySalonUtil.checkMaxLength(String.valueOf(this.number), 8)) { Pattern pattern = Pattern.compile("[2-5][0-9]{7}"); Matcher matcher = pattern.matcher(String.valueOf(this.number)); return matcher.find(); } else { return false; } }
private boolean isValidCellNumber() { Pattern pattern; if (this.ddd == 11) { if (BeautySalonUtil.checkMaxLength(String.valueOf(this.number), 9)) { pattern = Pattern.compile("9[5-9][0-9]{7}"); } else { return false; } } else { if (BeautySalonUtil.checkMaxLength(String.valueOf(this.number), 8)) { pattern = Pattern.compile("[5-9][0-9]{7}"); } else { return false; } } Matcher matcher = pattern.matcher(String.valueOf(this.number)); return matcher.find(); }