這個(gè)由“百度知道”(這是個(gè)問事的好去處)的lyer提供,謝謝他了: 模塊一: Dim i, lyer, liu, a, pal, x, xuhuaiyu As Boolean Open "a.txt" For Input As #1 Do While Not EOF(1) Line Input #1, a liu = liu & vbCrLf & a Loop Close #1 For i = 1 To Len(liu) - 1 If Asc(Mid(liu, i, 1)) <; 0 Then xuhuaiyu = False pal = Mid(liu, i, 1) For x = 1 To Len(lyer) - 1 If Mid(lyer, x, 1) = pal Then xuhuaiyu = True Next If xuhuaiyu = False Then lyer = lyer & pal Next Open "c.txt" For Output As #1 Print #1, lyer Close #1 模塊二: Dim i, lyer(), liu, a, liu2, lyer2(), x, wilbeR, pan Open "b.txt" For Input As #1 Do While Not EOF(1) Line Input #1, a liu = liu & vbCrLf & a Loop Close #1 Open "c.txt" For Input As #1 Do While Not EOF(1) Line Input #1, a liu2 = liu2 & vbCrLf & a Loop Close #1 ReDim lyer(Len(liu) - 1) ReDim lyer2(Len(liu2) - 1) For i = 1 To Len(liu) - 1 lyer(i - 1) = Mid(liu, i, 1) Next For i = 1 To Len(liu2) - 1 lyer2(i - 1) = Mid(liu2, i, 1) Next For i = 1 To Len(liu) - 1 For x = 1 To Len(liu2) - 1 If lyer(i) = lyer2(x) Then lyer(i) = "WU HA" If lyer(i) = " " Then lyer(i) = "WU HA" Next x Next i For i = 1 To Len(liu) - 1 pan = lyer(i) If pan = "WU HA" Then pan = "" wilbeR = wilbeR & pan Next i Open "d.txt" For Output As #1 Print #1, wilbeR Close #1
'注:a.txt b.txt 需放在程序目錄下 'VB6 sp6 @ Win XP 調(diào)試成功
|
|