Attention
This functionality is only available in the C++ toolkits. For other languages, we recommend using language-specific functionality instead.
OETrimToSigFigs¶
std::string OETrimToSigFigs(const std::string &numstr)
Strips trailing zeros from a string representing a decimal number. Nothing is stripped if no decimal point is given. A single zero character is left if only zeros follow the decimal point. The function is smart enough to properly deal with scientific notation formats. The following table is an example of inputs and outputs to the function.
Input |
Output |
---|---|
1.00000 |
1.0 |
1.0 |
1.0 |
3.141600 |
3.1416 |
3.141600E+00 |
3.1416E+00 |