请问在VB里.字母和字母相加可以吗.我有两个或三个机器码,格式是:5VM35MLR和E04CC24AAF.这两个可以相加变成另一个机器码吗?
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 14:41:01
请问在VB里.字母和字母相加可以吗.我有两个或三个机器码,格式是:5VM35MLR和E04CC24AAF.这两个可以相加变成另一个机器码吗?
请问在VB里.字母和字母相加可以吗.
我有两个或三个机器码,格式是:5VM35MLR和E04CC24AAF.这两个可以相加变成另一个机器码吗?
请问在VB里.字母和字母相加可以吗.我有两个或三个机器码,格式是:5VM35MLR和E04CC24AAF.这两个可以相加变成另一个机器码吗?
Private Function Str_Int(StrY As String) As Integer
Str_Int = Asc(StrY)
If Str_Int < 58 And Str_Int > 47 Then
Str_Int = Str_Int - 48
ElseIf Str_Int < 91 And Str_Int > 64 Then
Str_Int = Str_Int - 55
ElseIf Str_Int < 123 And Str_Int > 96 Then
Str_Int = Str_Int - 61
End If
End Function
Private Function Int_Str(IntY As Integer) As String
If IntY < 10 Then
IntY = IntY + 48
ElseIf IntY < 36 Then
IntY = IntY + 55
Else
IntY = IntY + 61
End If
Int_Str = Chr(IntY)
End Function
Private Sub Command1_Click()
Dim StrK As String, StrL As String
Dim K As Integer, L As Integer, M As Integer
Text3 = ""
If Len(Text1.Text) > Len(Text2.Text) Then
StrK = Text1.Text
StrL = Text2.Text
Else
StrK = Text2.Text
StrL = Text1.Text
End If
K = Len(StrK)
L = Len(StrL)
Label1.Caption = Command1.Caption
For i = K To 1 Step -1
If i > K - L Then
M = Str_Int(Mid(StrK, i, 1)) + Str_Int(Mid(StrL, i + L - K, 1))
Text3 = Int_Str(IIf(M > 61, M - 61, M)) & Text3
Else
Text3 = Int_Str(Str_Int(Mid(StrK, i, 1))) & Text3
End If
Next i
End Sub