diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/stringutil.cxx | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index fb78981ac426..f46cd76808ff 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1815,7 +1815,9 @@ void Test::testCSV() { "1.0 ", European, false, 0.0 }, { "1.000", European, true, 1000.0 }, { "1137.999", English, true, 1137.999 }, - { "1.000.00", European, false, 0.0 } + { "1.000.00", European, false, 0.0 }, + { "+,123", English, false, 0.0 }, + { "-,123", English, false, 0.0 } }; for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aTests); i++) { OUString aStr(aTests[i].pStr, strlen (aTests[i].pStr), RTL_TEXTENCODING_UTF8); diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index 70313ffbaad1..606c0797e1fa 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -69,6 +69,7 @@ bool ScStringUtil::parseSimpleNumber( const sal_Unicode* pLast = p + (n-1); sal_Int32 nPosDSep = -1, nPosGSep = -1; sal_uInt32 nDigitCount = 0; + bool haveSeenDigit = false; sal_Int32 nPosExponent = -1; // Skip preceding spaces. @@ -106,6 +107,7 @@ bool ScStringUtil::parseSimpleNumber( { // this is a digit. aBuf.append(c); + haveSeenDigit = true; ++nDigitCount; } else if (c == dsep) @@ -130,8 +132,8 @@ bool ScStringUtil::parseSimpleNumber( { // this is a group (thousand) separator. - if (i == 0) - // not allowed as the first character. + if (!haveSeenDigit) + // not allowed before digits. return false; if (nPosDSep >= 0) @@ -216,6 +218,7 @@ bool ScStringUtil::parseSimpleNumber( const char* pLast = p + (n-1); sal_Int32 nPosDSep = -1, nPosGSep = -1; sal_uInt32 nDigitCount = 0; + bool haveSeenDigit = false; sal_Int32 nPosExponent = -1; // Skip preceding spaces. @@ -250,6 +253,7 @@ bool ScStringUtil::parseSimpleNumber( { // this is a digit. aBuf.append(c); + haveSeenDigit = true; ++nDigitCount; } else if (c == dsep) @@ -274,8 +278,8 @@ bool ScStringUtil::parseSimpleNumber( { // this is a group (thousand) separator. - if (i == 0) - // not allowed as the first character. + if (!haveSeenDigit) + // not allowed before digits. return false; if (nPosDSep >= 0) |