Bug 14230 – [REG2.067b2] std.array.join misses the first element which is empty string
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-28T02:45:00Z
Last change time
2017-07-19T17:42:17Z
Keywords
pull
Assigned to
nobody
Creator
jiki
Comments
Comment #0 by jiki — 2015-02-28T02:45:38Z
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
}
------------------------------------------------------
Comment #1 by github-bugzilla — 2015-02-28T21:03:20Z