diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-03 16:14:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-03 20:21:33 +0200 |
commit | a0533a8d18bb902f70fd4c6418f44875eab38999 (patch) | |
tree | 179c71f3092ed1bda4917c31ad48eecc0fa27ad0 /chart2 | |
parent | 605a34ccca64c86c89e4e8b6e4b049175a994d54 (diff) |
simplify RegressionCurveCalculator::getFormattedString
no need to format number as OString and then convert to OUString, just
format it as OUString
Change-Id: I2ad686c4d69302c545d483bcfe7a1a129ce38eac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133765
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/tools/RegressionCurveCalculator.cxx | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx index fbf5d243bdb9..fd2ca4329e42 100644 --- a/chart2/source/tools/RegressionCurveCalculator.cxx +++ b/chart2/source/tools/RegressionCurveCalculator.cxx @@ -98,9 +98,7 @@ OUString RegressionCurveCalculator::getFormattedString( { // round fNumber to *pStringLength characters const sal_Int32 nMinDigit = 6; // minimum significant digits for General format sal_Int32 nSignificantDigit = ( *pStringLength <= nMinDigit ? nMinDigit : *pStringLength ); - aResult = OStringToOUString( - ::rtl::math::doubleToString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true ), - RTL_TEXTENCODING_ASCII_US ); + aResult = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true ); // count characters different from significant digits (decimal separator, scientific notation) sal_Int32 nExtraChar = aResult.getLength() - *pStringLength; if ( nExtraChar > 0 && *pStringLength > nMinDigit ) @@ -108,9 +106,7 @@ OUString RegressionCurveCalculator::getFormattedString( nSignificantDigit = *pStringLength - nExtraChar; if ( nSignificantDigit < nMinDigit ) nSignificantDigit = nMinDigit; - aResult = OStringToOUString( - ::rtl::math::doubleToString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true ), - RTL_TEXTENCODING_ASCII_US ); + aResult = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true ); } fNumber = ::rtl::math::stringToDouble( aResult, '.', ',' ); } @@ -121,9 +117,7 @@ OUString RegressionCurveCalculator::getFormattedString( sal_Int32 nStringLength = 4; // default length if ( pStringLength ) nStringLength = *pStringLength; - aResult = OStringToOUString( - ::rtl::math::doubleToString( fNumber, rtl_math_StringFormat_G1, nStringLength, '.', true ), - RTL_TEXTENCODING_ASCII_US ); + aResult = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_G1, nStringLength, '.', true ); } return aResult; } |