Logo

Programming-Idioms

History of Idiom 76 > diff from v70 to v71

Edit summary for version 71 by programming-idioms.org:
[D] Variable name x

Version 70

2020-11-25, 22:04:49

Version 71

2020-11-25, 22:08:22

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Variables
s,x
Variables
s,x
Extra Keywords
int radix
Extra Keywords
int radix
Imports
import std.conv;
Imports
import std.conv;
Code
auto s = to!string(13,2);
Code
auto s = to!string(x,2);
Comments bubble
using std.conv.to(int value, base)
Comments bubble
Using std.conv.to(int value, base)
Doc URL
http://dlang.org/phobos/std_conv.html#.to
Doc URL
http://dlang.org/phobos/std_conv.html#.to