作者zxvc (zxvc)
看板C_Sharp
标题Re: 二进位数字字串转整数的方法
时间Sat Sep 8 08:31:34 2007
※ 引述《zxvc (zxvc)》之铭言:
: 二进位数字字串转整数的方法,
: 这可以部分替代Standard C++ Library的bitset class功能。
: For C++/CLI ( 我不会C# XD ):
: String ^ BinStr = "101";
: // Number 5 in decimal.
: MessageBox::Show( Convert::ToUInt32( BinStr, 2 ) + "" );
: // The second argument of ToUin32 represents base 2.
今天又在Google搜到如何把十进位数转成特定bit数的方法 ( For C++/CLI ):
MessageBox::Show( Convert::ToString( DecNum, 2 )->PadLeft( 8, '0' ) );
// PadLeft pads character '0' to the left of a string,
// so that the bits of a binary number is 8.
--
往生净土咒:
南无阿弥多婆夜 哆他伽哆夜 哆地夜他 阿弥唎都婆毘 阿弥唎哆
悉耽婆毘 阿弥唎哆 毘迦兰哆 伽弥腻 伽伽那 只多迦隶 莎婆诃
《佛说阿弥陀经》
http://web.cc.ncu.edu.tw/~93501025/amtf.doc
《金刚经》
http://web.cc.ncu.edu.tw/~93501025/jg.doc
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.204.3
※ 编辑: zxvc 来自: 140.115.204.3 (09/08 08:33)