www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5542] New: std.string.join() for chars too

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5542

           Summary: std.string.join() for chars too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 07 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5542




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" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 30 2013