[Issue 20064] New: format separator fails with leading zeros
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 19 00:58:37 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20064
Issue ID: 20064
Summary: format separator fails with leading zeros
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: svnpenn at gmail.com
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
--
More information about the Digitalmars-d-bugs
mailing list