这个不用加验证方法,用规则mask(正则表达式,参考java.util.regex.Pattern)就可以做到
ip: ^([1|2]?\d{2}\x2E){3}[1|2]?\d{2}$