www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6640] New: More formatting consistency between string and range of char

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: k.hara.pg gmail.com



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: -------
Sep 10 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6640


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



https://github.com/D-Programming-Language/phobos/commit/740f3ec78a82aef22d90a523d87f3078e47cbcaf

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 10 2011