www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - String to binary conversation

reply Vino <vino.bheeman hotmail.com> writes:
Hi All,

Request your help on how to convert a string to binary,eg "test" 
to 01110100 01100101 01110011 01110100.

From,
Vino.B
Feb 05 2018
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
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); -Steve
Feb 05 2018
next sibling parent Steven Schveighoffer <schveiguy yahoo.com> writes:
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
Feb 05 2018
prev sibling parent Marc <jckj33 gmail.com> writes:
On Monday, 5 February 2018 at 18:40:40 UTC, 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); -Steve
whoa, what isn't built-in in D...
Feb 08 2018