Commit c0fb56e
authored
Allow alternative space characters as group separator when parsing numbers (#1007)
The French group separator is `"\u202f"` (narrow non-breaking space),
but when parsing numbers in the real world, you will most often encounter
either a regular space character (`" "`) or a non-breaking space character
(`"\xa0"`).
The issue was partially adressed earlier in #637,
but only to allow regular spaces instead of non-breaking spaces `"\xa0"` in
`parse_decimal`.
This commit goes further by changing both `parse_number` and `parse_decimal`
to allow certain other space characters when the group character is itself a space character,
but is not present in the string to parse.
Unit tests are included.1 parent fe82fbc commit c0fb56e
2 files changed
+41
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
1001 | 1010 | | |
1002 | 1011 | | |
1003 | 1012 | | |
| |||
1026 | 1035 | | |
1027 | 1036 | | |
1028 | 1037 | | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1029 | 1048 | | |
1030 | | - | |
| 1049 | + | |
1031 | 1050 | | |
1032 | 1051 | | |
1033 | 1052 | | |
| |||
1085 | 1104 | | |
1086 | 1105 | | |
1087 | 1106 | | |
1088 | | - | |
| 1107 | + | |
1089 | 1108 | | |
1090 | | - | |
| 1109 | + | |
1091 | 1110 | | |
1092 | 1111 | | |
1093 | | - | |
| 1112 | + | |
1094 | 1113 | | |
1095 | 1114 | | |
1096 | 1115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
754 | 763 | | |
755 | 764 | | |
756 | 765 | | |
| |||
761 | 770 | | |
762 | 771 | | |
763 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
764 | 782 | | |
765 | 783 | | |
766 | 784 | | |
| |||
0 commit comments