12741.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>FW: 补充范例码</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>FW: 补充范例码</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:WOEIOA@MS6.HINET.NET">小呆</a> on May 09, 1999 at 00:07:16:<p>
In Reply to: <a href="12707.html">Re: 如何将字元转成二进位码</a> posted by yeong huann on May 07, 1999 at 17:27:47:<p>
: 利用ASC(Y)得到89<br>: 再利用辗转相除法(用2除),取其余数,再将余数以字串处理<br>: 依序相加即可<p>Private Sub Command1_Click()<br>            Debug.Print DecToBin("Y")           '显示Y的二进位码<br>End Sub<br>Private Function DecToBin(a As String) As String<br>        Dim temp As String<br>        Dim i, s<br>        temp = ""<br>        s = Asc(a)                         '将字串转换成ascii码<br>        Debug.Print "十进位="; s<br>        Debug.Print "十六进位=0x"; Hex(s)  '将字串转换成十六进位<br>        For i = 7 To 0 Step -1<br>              If s And 2 ^ i Then            '判断其位元是否为1<br>                   temp = temp + "1"<br>              Else<br>                   temp = temp + "0"<br>             End If<br>        Next i<br>        Debug.Print "二进位="; temp<br>        DecToBin = temp<br>End Function<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 12741-->
</ul><!--end: 12741-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?