判断ip是否合法
//用來判斷ip是否合法
public boolean checkIp(String tempIp) {String regex = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}";Pattern p = Pattern.compile(regex);Matcher m = p.matcher(tempIp);return m.matches();}
public boolean checkIp(String tempIp) {String regex = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}";Pattern p = Pattern.compile(regex);Matcher m = p.matcher(tempIp);return m.matches();}
總結
- 上一篇: 深入了解INF
- 下一篇: 网页如何做到适应在手机上浏览