62,615
社区成员
发帖
与我相关
我的任务
分享
String str = "";
System.out.println(str.matches("^[0-9]+$"));
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
/**
*
* @author Administrator
*/
public class Func {
public void matchesTest() {
String str = " ";
System.out.println(str.matches("[0-9]*"));//false
}
public static void main(String[] args) {
Func f = new Func();
f.matchesTest();
}
}
String str = "";
System.out.println(str.matches("[0-9]"));