www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14230] New: [REG2.067b2] std.array.join misses the first

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

          Issue ID: 14230
           Summary: [REG2.067b2] std.array.join misses the first element
                    which is empty string
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: jiki red.email.ne.jp

I sometimes use join() in this way.

join( [""] ~ ["aa","bb","cc"], "  " )
 --> "  aa  bb  cc"

This doesn't work properly in D2.
This is a regression, probably.

------------------------------------------------------
import std.stdio;
import std.array;

void main()
{
    string[] ary = ["","aa","bb","cc"]; // leaded by _empty_ element
    writeln(ary.join("  "));
        // In 2.067b2, this outputs "aa  bb  cc" or asserts inside of join()

    assert(ary.join("  ") == "  aa  bb  cc"); // OK in 2.067b1 and olders
}
------------------------------------------------------

--
Feb 27 2015