[Issue 6640] New: More formatting consistency between string and range of char
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 10 06:28:47 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6640
Summary: More formatting consistency between string and range
of char
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-09-10 06:28:32 PDT ---
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]
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list