Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ca214981
Kaydet (Commit)
ca214981
authored
Eki 27, 2017
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Handle decimalSeparatorAlternative in ScColumn::ParseString(), tdf#81671
Change-Id: I9f708b28ee5fdb23217e75386a64ab86dacfd3c4
üst
c1a47f1a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
stringutil.hxx
sc/inc/stringutil.hxx
+2
-1
ucalc.cxx
sc/qa/unit/ucalc.cxx
+1
-0
column3.cxx
sc/source/core/data/column3.cxx
+4
-2
stringutil.cxx
sc/source/core/tool/stringutil.cxx
+3
-3
No files found.
sc/inc/stringutil.hxx
Dosyayı görüntüle @
ca214981
...
@@ -122,12 +122,13 @@ public:
...
@@ -122,12 +122,13 @@ public:
* @param rStr string to parse
* @param rStr string to parse
* @param dsep decimal separator
* @param dsep decimal separator
* @param gsep group separator (aka thousands separator)
* @param gsep group separator (aka thousands separator)
* @param dsepa decimal separator alternative, usually 0
* @param rVal value of successfully parsed number
* @param rVal value of successfully parsed number
*
*
* @return true if the string is a valid number, false otherwise.
* @return true if the string is a valid number, false otherwise.
*/
*/
static
bool
parseSimpleNumber
(
static
bool
parseSimpleNumber
(
const
OUString
&
rStr
,
sal_Unicode
dsep
,
sal_Unicode
gsep
,
double
&
rVal
);
const
OUString
&
rStr
,
sal_Unicode
dsep
,
sal_Unicode
gsep
,
sal_Unicode
dsepa
,
double
&
rVal
);
static
bool
parseSimpleNumber
(
static
bool
parseSimpleNumber
(
const
char
*
p
,
size_t
n
,
char
dsep
,
char
gsep
,
double
&
rVal
);
const
char
*
p
,
size_t
n
,
char
dsep
,
char
gsep
,
double
&
rVal
);
...
...
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
ca214981
...
@@ -1641,6 +1641,7 @@ void Test::testCSV()
...
@@ -1641,6 +1641,7 @@ void Test::testCSV()
bool
bResult
=
ScStringUtil
::
parseSimpleNumber
bool
bResult
=
ScStringUtil
::
parseSimpleNumber
(
aStr
,
aTests
[
i
].
eSep
==
English
?
'.'
:
','
,
(
aStr
,
aTests
[
i
].
eSep
==
English
?
'.'
:
','
,
aTests
[
i
].
eSep
==
English
?
','
:
'.'
,
aTests
[
i
].
eSep
==
English
?
','
:
'.'
,
0
,
nValue
);
nValue
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"CSV numeric detection failure"
,
aTests
[
i
].
bResult
,
bResult
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"CSV numeric detection failure"
,
aTests
[
i
].
bResult
,
bResult
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"CSV numeric value failure"
,
aTests
[
i
].
nValue
,
nValue
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"CSV numeric value failure"
,
aTests
[
i
].
nValue
,
nValue
);
...
...
sc/source/core/data/column3.cxx
Dosyayı görüntüle @
ca214981
...
@@ -1806,13 +1806,15 @@ bool ScColumn::ParseString(
...
@@ -1806,13 +1806,15 @@ bool ScColumn::ParseString(
const
LocaleDataItem2
&
aLocaleItem
=
pLocale
->
getLocaleItem
();
const
LocaleDataItem2
&
aLocaleItem
=
pLocale
->
getLocaleItem
();
const
OUString
&
rDecSep
=
aLocaleItem
.
decimalSeparator
;
const
OUString
&
rDecSep
=
aLocaleItem
.
decimalSeparator
;
const
OUString
&
rGroupSep
=
aLocaleItem
.
thousandSeparator
;
const
OUString
&
rGroupSep
=
aLocaleItem
.
thousandSeparator
;
if
(
rDecSep
.
getLength
()
!=
1
||
rGroupSep
.
getLength
()
!=
1
)
const
OUString
&
rDecSepAlt
=
aLocaleItem
.
decimalSeparatorAlternative
;
if
(
rDecSep
.
getLength
()
!=
1
||
rGroupSep
.
getLength
()
!=
1
||
rDecSepAlt
.
getLength
()
>
1
)
break
;
break
;
sal_Unicode
dsep
=
rDecSep
[
0
];
sal_Unicode
dsep
=
rDecSep
[
0
];
sal_Unicode
gsep
=
rGroupSep
[
0
];
sal_Unicode
gsep
=
rGroupSep
[
0
];
sal_Unicode
dsepa
=
rDecSepAlt
.
toChar
();
if
(
!
ScStringUtil
::
parseSimpleNumber
(
rString
,
dsep
,
gsep
,
nVal
))
if
(
!
ScStringUtil
::
parseSimpleNumber
(
rString
,
dsep
,
gsep
,
dsepa
,
nVal
))
break
;
break
;
rCell
.
set
(
nVal
);
rCell
.
set
(
nVal
);
...
...
sc/source/core/tool/stringutil.cxx
Dosyayı görüntüle @
ca214981
...
@@ -49,7 +49,7 @@ void ScSetStringParam::setNumericInput()
...
@@ -49,7 +49,7 @@ void ScSetStringParam::setNumericInput()
}
}
bool
ScStringUtil
::
parseSimpleNumber
(
bool
ScStringUtil
::
parseSimpleNumber
(
const
OUString
&
rStr
,
sal_Unicode
dsep
,
sal_Unicode
gsep
,
double
&
rVal
)
const
OUString
&
rStr
,
sal_Unicode
dsep
,
sal_Unicode
gsep
,
sal_Unicode
dsepa
,
double
&
rVal
)
{
{
// Actually almost the entire pre-check is unnecessary and we could call
// Actually almost the entire pre-check is unnecessary and we could call
// rtl::math::stringToDouble() just after having exchanged ascii space with
// rtl::math::stringToDouble() just after having exchanged ascii space with
...
@@ -110,7 +110,7 @@ bool ScStringUtil::parseSimpleNumber(
...
@@ -110,7 +110,7 @@ bool ScStringUtil::parseSimpleNumber(
haveSeenDigit
=
true
;
haveSeenDigit
=
true
;
++
nDigitCount
;
++
nDigitCount
;
}
}
else
if
(
c
==
dsep
)
else
if
(
c
==
dsep
||
(
dsepa
&&
c
==
dsepa
)
)
{
{
// this is a decimal separator.
// this is a decimal separator.
...
@@ -125,7 +125,7 @@ bool ScStringUtil::parseSimpleNumber(
...
@@ -125,7 +125,7 @@ bool ScStringUtil::parseSimpleNumber(
nPosDSep
=
i
;
nPosDSep
=
i
;
nPosGSep
=
-
1
;
nPosGSep
=
-
1
;
aBuf
.
append
(
c
);
aBuf
.
append
(
dsep
);
// append the separator that is parsed in stringToDouble() below
nDigitCount
=
0
;
nDigitCount
=
0
;
}
}
else
if
(
c
==
gsep
)
else
if
(
c
==
gsep
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment