diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-12-13 14:55:13 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-12-14 12:20:37 -0500 |
commit | 15254fc821d2bbed205e814c689b19cafaf1eb8a (patch) | |
tree | 2dd4d43bbd7c958b7589750b28173d2e307e3a47 | |
parent | a0bdbcf6481ab9176a7c763284991887d00161ff (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.
-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 ae73746e1..31efe6a3e 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. |