http://d.puremagic.com/issues/show_bug.cgi?id=3018

           Summary: linefeed ignored after positional parameter in
                    std.format
           Product: D
           Version: 2.030
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: ghaec...@idworld.net


In std.format, a linefeed after a positional parameter is ignored.  A format
string ending with a positional parameter throws RangeError.

--------------------------------------------------------------
// Demo code

string line1 = "line 1";
string line2 = "line 2";

writefln("With %%s parameters... ok");
writefln("  %s\n  %s\n  %s", line1, line2, line1);

writefln("\nWith positional parameters... ignores linefeed");
writefln("  %1$\n  %2$\n  %1$\n", line1, line2);

writefln("\nWithout trailing linefeed... throws RangeError");
writefln("  %1$\n  %2$\n  %1$", line1, line2);
--------------------------------------------------------------

Output:

With %s parameters... ok
  line 1
  line 2
  line 1

With positional parameters... ignores linefeed
  line 1  line 2  line 1

Without trailing linefeed... throws RangeError
core.exception.rangeer...@std.format(1578): Range violation
  line 1  line 2

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

Reply via email to