日期:2014-05-18 浏览次数:20667 次
String name="sdfeie sdf 260"+'\r'+'\n'+"[ftp]";
Matcher strMa = Pattern.compile("\\[ftp\\]").matcher(name);
System.out.println(name);
if(strMa.find())
{
System.out.println(strMa.group());
}
if(name.matches("\\[ftp\\]"))
{
System.out.println(name);
}
String name = "123123";
System.out.println(name.matches("\\d")); //输出false
System.out.println(name.matches("\\d*")); //输出true
name = "12a";
System.out.println(name.matches("\\d*")); //输出false