summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-12-13 15:17:30 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-12-14 12:20:50 -0500
commit6a28e8397ae7a913dc7af1d2bcb3590ce975c1ac (patch)
tree145d916c057e9d8b7f4fa95174e30d50e27f0709
parent15254fc821d2bbed205e814c689b19cafaf1eb8a (diff)
The previous commit would skip *all* spaces. This is the right fix.
-rw-r--r--sc/source/core/tool/stringutil.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx
index 31efe6a3e..136b0beff 100644
--- a/sc/source/core/tool/stringutil.cxx
+++ b/sc/source/core/tool/stringutil.cxx
@@ -63,17 +63,24 @@ bool ScStringUtil::parseSimpleNumber(
sal_Int32 nPosDSep = -1, nPosGSep = -1;
sal_uInt32 nDigitCount = 0;
- for (sal_Int32 i = 0; i < n; ++i, ++p)
+ sal_Int32 i = 0;
+
+ // Skip preceding spaces.
+ for (i = 0; i < n; ++i, ++p)
+ {
+ sal_Unicode c = *p;
+ if (c != 0x0020 && c != 0x00A0)
+ // first non-space character. Exit.
+ break;
+ }
+
+ for (; i < n; ++i, ++p)
{
sal_Unicode c = *p;
if (c == 0x00A0)
// unicode space to ascii space
c = 0x0020;
- if (c == 0x0020)
- // Skip preceding spaces.
- continue;
-
if (sal_Unicode('0') <= c && c <= sal_Unicode('9'))
{
// this is a digit.