D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5542 - std.string.join() for chars too
Summary: std.string.join() for chars too
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-07 14:32 UTC by bearophile_hugs
Modified: 2016-04-11 22:40 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-02-07 14:32:50 UTC
This is Python 2.6.6 code (shell):

>>> "x".join("123")
'1x2x3'


This is handy in several situations. So I'd like std.string.join() to join chars in a similar way:

join("123", "x") ==> "1x2x3"


See also bug 4468
Comment 1 bearophile_hugs 2013-09-30 04:26:06 UTC
In Python and Haskell:

>>> s = "language"
>>> "|".join(s)
'l|a|n|g|u|a|g|e'


Prelude> intersperse '|' s
Prelude Data.List> intersperse '|' s
"l|a|n|g|u|a|g|e"
Comment 2 Robert Schadek 2014-09-16 21:44:01 UTC
superseded by issue 8851
Comment 3 bearophile_hugs 2014-09-17 05:45:56 UTC
(In reply to Robert Schadek from comment #2)
> superseded by issue 8851

They are different requests.
Comment 4 Jack Stouffer 2016-04-11 22:40:31 UTC
This is a one liner,

    string input = "123";
    auto result = input.roundRobin('x'.repeat(input.length - 1));

Going off of Walter's comments in this PR, https://github.com/D-Programming-Language/phobos/pull/4153, I am marking this as WONTFIX.