开发者

Convert java method into cpp

开发者 https://www.devze.com 2023-03-04 23:06 出处:网络
public boolean isDoubleValue(String s) { try { Double.valueOf(s); return true; } cat开发者_运维技巧ch (Exception e) {
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

精彩评论

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