No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
main.cpp
returns_a_string_equivalent_of_the_number_n.pro

README.md

How to use QString::number static public member function to return a specified format and precision.

(c) Roland Ihasz - https://lnrsoft.com

QString QString::number(double n, char format = 'g', int precision = 6) returns a string equivalent of the number n, formatted according to the specified format and precision.

Let’s see the following simple example. There are 3 double values x, y, z. We want to return the result of the following equation:
(x / z) * (5.961 / y)
We also want to allow the user to set the precision of the result.

Note = there are many ways to solve this issue, much simpler, but this time I want to demonstrate how we do in Qt.

How to return a string equivalent of the number n using Qt was written by Roland Ihasz, you can modify or distribute. You can do anything you want with this software, just don't say you wrote it.

More info on doc.qt.io