
Dim MyLineStr As String
MyStr = ""
'读取原文件信息
Open "e:\1.txt" For Input As #1 '以读的方式打开文件
Do While Not EOF(1) ' 循环至文件尾
Line Input #1, MyLineStr '读入一行
If Left(MyLineStr, 2) = "TH" Then
MyStr = MyStr & MyLineStr & vbCrLf
End If
Loop
Close #1 ' 关闭文件。
'写文件
Open "e:\2.txt" For Output As #1 '以输出方式打开文件
Print #1, MyStr
Close #1 ' 关闭文件。
'text1 对应你的输入字符串'text2 对应的反序的字符串
'command1 对应的 分离并反序按钮
'command2 对应的清除按钮
'其中 a 对应的 ascii 码 为97 z 对应的 ascii 码 为122
'A 对应的 ascii 码 为65 Z 对应的 ascii 码 为90
Private Sub Command1_Click()
''计算反码
If Text1.Text <>"" Then
For i = 0 To Len(Text1.Text) - 1
c = Mid(Text1.Text, Len(Text1.Text) - i, 1)
If Asc(c) >65 And Asc(c) <90 Or Asc(c) >97 And Asc(c) <122 Then
''是字母,则输出显示
Text2.Text = Text2.Text &c
Else
End If
Next
End If
End Sub
Private Sub Command2_Click()
''清除
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Command1_Click()Dim A(1 To 7) As Integer
Dim N As Integer, I As Integer, T As Integer
Dim StrT As String, J As Integer, Flg As Boolean
Randomize
For I = 1 To 5
N = 0
Do While N <7
T = Int(31 * Rnd) + 1
Flg = False
For J = 1 To N
If A(J) = T Then Flg = True: Exit For
Next
If Not Flg Then N = N + 1: A(N) = T
Loop
StrT = ""
For J = 1 To 7
StrT = StrT &A(J) &" "
Next
List1.AddItem StrT
Next
End Sub
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)