我的想法是这样的,但我不知道正确的代码
if (mystring.matches("[0-9.]+")){ //do something here }else{ //do something here }
我想我差不多了.唯一的问题是字符串中可能存在多个小数点.我确实找到了这个答案,但我找不到如何.
java regex string decimal
decimal ×1
java ×1
regex ×1
string ×1