← Back to index
|
Original Bugzilla link
Bug 6640 – More formatting consistency between string and range of char
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-10T06:28:00Z
Last change time
2011-09-10T21:16:31Z
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0
by k.hara.pg — 2011-09-10T06:28:32Z
Sample code: ---- import std.stdio, std.range; void main() { struct Range { string value; const @property bool empty(){ return !value.length; } const @property dchar front(){ return value.front(); } void popFront(){ value.popFront(); } const @property size_t length(){ return value.length; } } auto s = "string"; auto r = Range("string"); writef("[%s]", s); writefln("[%s]", r); writef("[%10s]", s); writefln("[%10s]", r); writef("[%-10s]", s); writefln("[%-10s]", r); writef("[%(%02x %)]", s); writefln("[%(%02x %)]", r); writef("[%(%s %)]", s); writefln("[%(%s %)]", r); } Outputs: ---- [string][string] // OK [ string][ string] // OK [string ][string ] // OK [73 74 72 69 6e 67][string] // expects [73 74 72 69 6e 67] [115 116 114 105 110 103][string] // expects [s t r i n g]
Comment #1
by k.hara.pg — 2011-09-10T21:16:31Z
https://github.com/D-Programming-Language/phobos/commit/740f3ec78a82aef22d90a523d87f3078e47cbcaf