String to binary conversation
Steven Schveighoffer
schveiguy at yahoo.com
Mon Feb 5 18:41:48 UTC 2018
On 2/5/18 1:40 PM, Steven Schveighoffer wrote:
> On 2/5/18 1:27 PM, Vino wrote:
>> Hi All,
>>
>> Request your help on how to convert a string to binary,eg "test" to
>> 01110100 01100101 01110011 01110100.
>
> import std.stdio, std.string;
> writefln("%(%b %)", "test".representation);
For leading 0s:
writefln("%(%08b %)", "test".representation);
-Steve
More information about the Digitalmars-d-learn
mailing list