summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/stringutil.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-12-13 15:17:30 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-12-13 15:17:30 -0500
commit933cb2a05aa9d78323f748af8a8883a1e9d5a2d1 (patch)
treed2f8cf3acd856775e14ceff1f7090b75c366c0a6 /sc/source/core/tool/stringutil.cxx
parent68fa34d5bacfab7a5764bdfb84127218082e1528 (diff)
The previous commit would skip *all* spaces. This is the right fix.
Diffstat (limited to 'sc/source/core/tool/stringutil.cxx')
-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 7fcae1e3adc1..cb550585b081 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.