开发者

Convert java method into cpp

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜