<分区>
Pattern p = Pattern.compile("^\\+(?:[0-9] ?){6,14}[0-9]$");
//Match the given string with the pattern
Matcher m = p.matcher(numberstr);
//check whether match is found
boolean numberFound = m.matches();
标签 android
<分区>
Pattern p = Pattern.compile("^\\+(?:[0-9] ?){6,14}[0-9]$");
//Match the given string with the pattern
Matcher m = p.matcher(numberstr);
//check whether match is found
boolean numberFound = m.matches();
最佳答案
1) 如果你想验证一个文本字段,那么他们只能输入你需要放入 XML 中的电话号码
android:phoneNumber="true"
2) 或者,如果您想验证电话号码,请使用 Linkify类,您可以使用 MatchFilter它提供的接口(interface)用于获取字符序列中已识别的电话号码。
关于android - 如何在 android ,"starts with +"中放置电话号码验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4314196/