www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12348] New: toImpl(Target,Source)(Source source, radix) add range support

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

           Summary: toImpl(Target,Source)(Source source, radix) add range
                    support
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: kozzi11 gmail.com


--- Comment #0 from Daniel Kozak <kozzi11 gmail.com> 2014-03-11 09:04:12 PDT ---
Few days ago I need convert ascii7 binary string into chars.

For example something like this:
string str = "10101011010101"; // contains "UU"

So my first attempt has been something like this:

foreach(chunk; str.chunks(7)) {
    write(to!char(chunk,2));
}

It doesn't work.

But this works ok:
foreach(chunk; str.chunks(7)) {
    write(to!char(to!ubyte(to!string(chunk), 2))); // but seems ugly
    //write(to!char(parse!ubyte(chunk, 2))); //this works too but still not
perfect
}

It would be great if the code from my first attempt works

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 11 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12348


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2014-03-11 09:09:45 PDT ---
This is a basic need. So perhaps it's already in Bugzilla, please search for
it.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 11 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12348


safety0ff.bugz <safety0ff.bugz gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz gmail.com


--- Comment #2 from safety0ff.bugz <safety0ff.bugz gmail.com> 2014-03-11
13:53:17 PDT ---
(In reply to comment #1)
 This is a basic need. So perhaps it's already in Bugzilla, please search for
 it.

Issue #10175? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 11 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12348


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #3 from bearophile_hugs eml.cc 2014-03-11 14:23:12 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
 This is a basic need. So perhaps it's already in Bugzilla, please search for
 it.

Issue #10175?

Yes, right. *** This issue has been marked as a duplicate of issue 10175 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 11 2014