diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-12-13 14:55:13 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-12-13 14:56:01 -0500 |
commit | 68fa34d5bacfab7a5764bdfb84127218082e1528 (patch) | |
tree | 8eaa375f304d706ef5bbb548503b27e507b7e817 /sc/source/core/tool/stringutil.cxx | |
parent | 8ede48abe4f9abc22ec0c73afb6a6e8d39702a05 (diff) |
When parsing numbers, ignore preceding spaces.
Also, increment the char pointer and use it directly, which is
faster than accessing char via [] in each iteration.
Diffstat (limited to 'sc/source/core/tool/stringutil.cxx')
-rw-r--r-- | sc/source/core/tool/stringutil.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index fd20988e688c..7fcae1e3adc1 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -63,13 +63,17 @@ bool ScStringUtil::parseSimpleNumber( sal_Int32 nPosDSep = -1, nPosGSep = -1; sal_uInt32 nDigitCount = 0; - for (sal_Int32 i = 0; i < n; ++i) + for (sal_Int32 i = 0; i < n; ++i, ++p) { - sal_Unicode c = p[i]; + 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. |