mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-06-13 12:54:14 +00:00
Parser: Prepend 0
to all strings starting with .
, even just .
[#838]
This commit is contained in:
parent
8684783139
commit
659bca3660
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
Copyright (C) 2012-2021 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
or alternatively under the terms of the Apache License Version 2.0.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -75,6 +75,10 @@ public class Decimal_adp_ {
|
|||||||
if (raw.contains("e")) {
|
if (raw.contains("e")) {
|
||||||
raw = raw.replace("e", "E");
|
raw = raw.replace("e", "E");
|
||||||
}
|
}
|
||||||
|
// 2021-02-13|ISSUE#:838|Parse '.' as '0.'; PAGE:en.w:2019_FIVB_Volleyball_Women%27s_Challenger_Cup#Pool_A
|
||||||
|
if (raw.startsWith(".")) {
|
||||||
|
raw = "0" + raw;
|
||||||
|
}
|
||||||
BigDecimal bd = (BigDecimal)nf.parse(raw);
|
BigDecimal bd = (BigDecimal)nf.parse(raw);
|
||||||
return new Decimal_adp(bd);
|
return new Decimal_adp(bd);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
Copyright (C) 2012-2021 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
or alternatively under the terms of the Apache License Version 2.0.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -42,6 +42,9 @@ public class Decimal_adp__tst {
|
|||||||
fxt.Test_parse("1.2E1", "12");
|
fxt.Test_parse("1.2E1", "12");
|
||||||
fxt.Test_parse("1.2e1", "12"); // 2020-08-27|ISSUE#:565|Parse 'e' as 'E'; PAGE:en.w:Huntington_Plaza
|
fxt.Test_parse("1.2e1", "12"); // 2020-08-27|ISSUE#:565|Parse 'e' as 'E'; PAGE:en.w:Huntington_Plaza
|
||||||
}
|
}
|
||||||
|
@Test public void parse_dot() {
|
||||||
|
fxt.Test_parse(".", "0"); // 2021-02-13|ISSUE#:838|Parse '.' as '0.'; PAGE:en.w:2019_FIVB_Volleyball_Women%27s_Challenger_Cup#Pool_A
|
||||||
|
}
|
||||||
@Test public void Truncate_decimal() {
|
@Test public void Truncate_decimal() {
|
||||||
fxt.Test_truncate_decimal("1", "1");
|
fxt.Test_truncate_decimal("1", "1");
|
||||||
fxt.Test_truncate_decimal("1.1", "1");
|
fxt.Test_truncate_decimal("1.1", "1");
|
||||||
|
Loading…
Reference in New Issue
Block a user