如何确定字符串中包含的值是否为double [英] How to find out if the value contained in a string is double or not
本文介绍了如何确定字符串中包含的值是否为double的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Java中,我试图找出字符串中包含的值是否为double?
In Java, I am trying to find out if the value contained in a string is double or not?
推荐答案
boolean isDouble(String str) {
try {
Double.parseDouble(str);
return true;
} catch (NumberFormatException e) {
return false;
}
}
这篇关于如何确定字符串中包含的值是否为double的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文