Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
2b7a146f
Commit
2b7a146f
authored
Jul 18, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a regression in handling digit separators (#1782)
parent
89d0c712
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
include/fmt/format.h
include/fmt/format.h
+1
-1
test/locale-test.cc
test/locale-test.cc
+1
-0
No files found.
include/fmt/format.h
View file @
2b7a146f
...
@@ -1559,7 +1559,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
...
@@ -1559,7 +1559,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
int
num_digits
=
count_digits
(
abs_value
);
int
num_digits
=
count_digits
(
abs_value
);
int
size
=
num_digits
,
n
=
num_digits
;
int
size
=
num_digits
,
n
=
num_digits
;
std
::
string
::
const_iterator
group
=
groups
.
cbegin
();
std
::
string
::
const_iterator
group
=
groups
.
cbegin
();
while
(
group
!=
groups
.
cend
()
&&
n
um_digits
>
*
group
&&
*
group
>
0
&&
while
(
group
!=
groups
.
cend
()
&&
n
>
*
group
&&
*
group
>
0
&&
*
group
!=
max_value
<
char
>
())
{
*
group
!=
max_value
<
char
>
())
{
size
+=
sep_size
;
size
+=
sep_size
;
n
-=
*
group
;
n
-=
*
group
;
...
...
test/locale-test.cc
View file @
2b7a146f
...
@@ -61,6 +61,7 @@ TEST(LocaleTest, Format) {
...
@@ -61,6 +61,7 @@ TEST(LocaleTest, Format) {
std
::
locale
special_grouping_loc
(
std
::
locale
(),
new
special_grouping
<
char
>
());
std
::
locale
special_grouping_loc
(
std
::
locale
(),
new
special_grouping
<
char
>
());
EXPECT_EQ
(
"1,23,45,678"
,
fmt
::
format
(
special_grouping_loc
,
"{:L}"
,
12345678
));
EXPECT_EQ
(
"1,23,45,678"
,
fmt
::
format
(
special_grouping_loc
,
"{:L}"
,
12345678
));
EXPECT_EQ
(
"12,345"
,
fmt
::
format
(
special_grouping_loc
,
"{:L}"
,
12345
));
std
::
locale
small_grouping_loc
(
std
::
locale
(),
new
small_grouping
<
char
>
());
std
::
locale
small_grouping_loc
(
std
::
locale
(),
new
small_grouping
<
char
>
());
EXPECT_EQ
(
"4,2,9,4,9,6,7,2,9,5"
,
EXPECT_EQ
(
"4,2,9,4,9,6,7,2,9,5"
,
...
...
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