Search code examples
qtc++11qstringscientific-notation

Convert QString (concatenated QStrings) to scientific notation


I would like to convert the QString:

 QString ch1_rxBitErrCount = ch1_totalBitCount_ones + "." + ch1_totalBitCount_dec + "E" + ch1_totalBitCount_exp;
 //ch1_rxBitErrCount = "1.56E13";

to scientific notation, recognizable/computable in Qt.

Haven't found the reference function to do this, so if someone could point me to it, that'd be much appreciated.

Thanks in advance!


Solution

  • You can convert QString to float or double over QString methods toFloat()or toDouble() like:

    double mydouble = ch1_rxBitErrCount.toDouble();