[Issue 12348] New: toImpl(Target, Source)(Source source, radix) add range support
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 11 09:04:16 PDT 2014
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 at puremagic.com
ReportedBy: kozzi11 at gmail.com
--- Comment #0 from Daniel Kozak <kozzi11 at 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: -------
More information about the Digitalmars-d-bugs
mailing list