https://blog.csdn.net/luliyuan/article/details/8548542
String sContentValue = "1234567";
boolean bCheckResult = true;
/* Int */
try
{
Integer iCheckValue = Integer.parseInt(sContentValue);
if (iCheckValue instanceof Integer == false)
{
bCheckResult = false;
}
}
catch(NumberFormatException e)
{
bCheckResult = false;
}
/* Double */
try
{
Double dCheckValue = Double.parseDouble(sContentValue);
if (dCheckValue instanceof Double == false)
{
bCheckResult = false;
}
}
catch(NumberFormatException e)
{
bCheckResult = false;
}
/* String */
if (sContentValue instanceof String == false)
{
bCheckResult = false;
}
---------------------
作者:luliyuan
来源:CSDN
原文:https://blog.csdn.net/luliyuan/article/details/8548542
版权声明:本文为博主原创文章,转载请附上博文链接!