Logo

Programming-Idioms

History of Idiom 76 > diff from v53 to v54

Edit summary for version 54 by Nikola Sivkov:
New Csharp implementation by user [Nikola Sivkov]

Version 53

2019-07-10, 12:19:16

Version 54

2019-09-26, 16:12:18

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"

Extra Keywords
int radix
Extra Keywords
int radix
Code
Convert.ToString(42,2);
// Prints : 101010
Convert.ToString(42, 2).PadLeft(8, '0');
// Prints  00101010
Doc URL
https://docs.microsoft.com/en-us/dotnet/api/system.convert.tostring?view=netframework-4.8