Private Sub Command1_Click()
Dim a() As String
a = Split(Text1.Text, ",")
For i = 0 To UBound(a)
If Len(a(i)) >= 4 Then
temp = Left(a(i), Len(a(i)) - 1)
For j = 0 To UBound(a)
If temp = a(j) Then
Exit For
ElseIf temp <> a(j) And j = UBound(a) Then
Text1.Text = Text1.Text & "," & temp
End If
Next
End If
Next
End SubPrivate Sub Form_Load()
Dim strLine As String
Text1.Text = ""
Open App.Path + "\pinyin.txt" For Input As #1
While Not EOF(1)
Line Input #1, strLine
Text1.Text = Text1.Text & strLine & vbCrLf
Wend
Close #1
End Sub
我现在读取文本文档里的东西只能是bang,wang,zhuang,chuai用半角英语逗号隔开的,输出结果是bang,wang,zhuang,chuai,ban,wan,zhuan,chua但是实际上我想读取的是
bang    帮棒
chuai   踹揣
wang    王忘
输出结果是
ban
bang    帮棒
chua    
chuai   踹揣
wan   
wang    王忘
各位请问我应该怎么改才能实现啊

解决方案 »

  1.   

    Private Sub Command1_Click() 
    Dim strLine As String, strArr() As String Text1 = ""Open App.Path & "\pinyin.txt" For Input As #1
    Do Until EOF(1)
        If Text1 > "" Theb Text1 = Text1 & vbCrLf
        Line Input #1, strLine 
        strArr = Split(strLine, " ")    If Len(strArr(0)) > 3 Then Text1 = Text1 & Left(strArr(0), Len(strArr(0)) - 1) & vbCrlf
        Text1 = Text1 & strLine
    Loop
    Close #1
    End Sub