📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Option Explicit
Public Function DecimalToBinary(DecimalValue As Long, MinimumDigits As Integer) As String
Dim result As String
Dim ExtraDigitsNeeded As Integer
DecimalValue = Abs(DecimalValue)
Do
result = CStr(DecimalValue Mod 2) & result
DecimalValue = DecimalValue \ 2
Loop While DecimalValue > 0
ExtraDigitsNeeded = MinimumDigits - Len(result)
If ExtraDigitsNeeded > 0 Then
result = String(ExtraDigitsNeeded, "0") & result
End If
DecimalToBinary = result
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -