"how to convert a string representing decimal number in exponential form to float in qt?" Code Answer


tofloat() should work. check that your string contains only the number. if the string contains something else too, for example "144.2e-3 a", then the tofloat() returns 0. note that also other numbers in the string will cause the conversion to fail, for example qstring("144.2e-3 100").tofloat() will return 0.

additional whitespace in the number string doesn't matter, but other characters do.

By Nikola Kirincic on April 26 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.