java用正则表达式判断程序接收的字符串是否符合手机号的格式,在下面修改
classTest{publicstaticvoidmain(String[]args){if(args.length<=0)return;Stringpattern="...
class Test{
public static void main(String[] args)
{
if(args.length<=0) return;
String pattern=" ";
System.out.println(args[0].matches(pattern));
}
} 展开
public static void main(String[] args)
{
if(args.length<=0) return;
String pattern=" ";
System.out.println(args[0].matches(pattern));
}
} 展开
2个回答
展开全部
public class Test
{
public static void main ( String[] args )
{
if (args.length <= 0)
{
return;
}
String pattern = "^(13[0-9]|15[01]|153|15[6-9]|180|18[23]|18[5-9])\\d{8}$";
System.out.println (args[0].matches (pattern));
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询