public boolean isDoubleValue(String s) {
try {
Double.valueOf(s);
return true;
} cat开发者_运维技巧ch (Exception e) {
return false;
}
}
But i want to convert this method into QT cpp. Can any one help me?
Thanks, Nagaraju
Since you need it in Qt (from your comment), you can use
double QString::toDouble ( bool * ok = 0 ) const
.
And you can check the value of ok
and return accordingly..
You probably want atof(). This is a standard c library function for converting strings to doubles.
精彩评论