Bug 20064 – format separator fails with leading zeros

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2019-07-19T00:58:37Z
Last change time
2019-08-04T12:42:55Z
Keywords
pull
Assigned to
No Owner
Creator
srpen6

Comments

Comment #0 by srpen6 — 2019-07-19T00:58:37Z
format separator fails with leading zeros Using this file: import std.format, std.stdio; void main() { auto aa = "%09,d".format(1234); writeln(aa); } Produces: 00001,234 Compare against JavaScript: (1234).toLocaleString(0, {minimumIntegerDigits: 7}); "0,001,234" Python: >>> format(1234, '08,') '0,001,234' Go: package main import "golang.org/x/text/language" import "golang.org/x/text/message" func main() { message.NewPrinter(language.English).Printf("%07d\n", 1234) // 0,001,234 } https://dlang.org/library/std/format/format
Comment #1 by dlang-bot — 2019-07-19T16:06:42Z
@shove70 created dlang/phobos pull request #7112 "Fix issue 20064 - format separator fails with leading zeros" fixing this issue: - Fix issue 20064 - format separator fails with leading zeros https://github.com/dlang/phobos/pull/7112
Comment #2 by dlang-bot — 2019-08-04T12:42:55Z
dlang/phobos pull request #7112 "Fix issue 20064,20069 - format functions make their final width and digits grouping conform to POSIX definition" was merged into master: - cb70a3859f9179aca2c18cfca7e258c82ec3e64f by shove70: Fix issue 20064 - format separator fails with leading zeros https://github.com/dlang/phobos/pull/7112