www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21776] New: %b, %o, %x and %X on integers does not obey plus

https://issues.dlang.org/show_bug.cgi?id=21776

          Issue ID: 21776
           Summary: %b, %o, %x and %X on integers does not obey plus and
                    space flag
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla bernis-buecher.de

All asserts fail, while with %d they work.

unittest
{
    assert(format!"%+b"(15) == "+1111");
    assert(format!"%+o"(15) == "+17");
    assert(format!"%+x"(15) == "+f");
    assert(format!"%+X"(15) == "+F");

    assert(format!"% b"(15) == " 1111");
    assert(format!"% o"(15) == " 17");
    assert(format!"% x"(15) == " f");
    assert(format!"% X"(15) == " F");
}

--
Mar 28