string binary = Convert.ToString(15, 2);
Console.WriteLine("{0}", binary);
打印:
1111
我希望它打印 00001000
因为数据类型是字符串而不是整数,所以我不能这样做:
Because the data type is of string and not integer I cannot do something like this:
Console.WriteLine("{0:00000000}", binary);
Console.WriteLine( binary.PadLeft(8, '0'));
这篇关于如何用零填充二进制字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
车牌检测有哪些好的算法?What are good algorithms for vehicle license plate detection?(车牌检测有哪些好的算法?)
Unity中图像的onClick事件onClick event for Image in Unity(Unity中图像的onClick事件)
运行总 C#Running Total C#(运行总 C#)
单击带有 JAvascript.ASP.NET C# 的超链接时删除目录Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(单击带有 JAvascript.ASP.NET C# 的超链接时删除目录)
asp.net listview 在单击时突出显示行asp.net listview highlight row on click(asp.net listview 在单击时突出显示行)
从函数调用按钮 OnClickCalling A Button OnClick from a function(从函数调用按钮 OnClick)