请问VB把一个TXT文本里的带符号里的内容全提取出来
请问VB把一个TXT文本里的带符号里的内容全提取出来,然后放在一个数组里,一个个的显视出来。。但是这文本里有多个不同的符号。请问如何过滤呢。文本内容:《不知道》[12.4...
请问VB把一个TXT文本里的带符号里的内容全提取出来,然后放在一个数组里,一个个的显视出来。。但是这文本里有多个不同的符号。请问如何过滤呢。
文本内容:《不知道》[12.45] [56.44] 《我是谁》{56}{544}。谢谢 展开
文本内容:《不知道》[12.45] [56.44] 《我是谁》{56}{544}。谢谢 展开
1个回答
展开全部
Dim panduan As Integer
Private Sub Command1_Click()
panduan = 0
CommonDialog1.Filter = "文本文档txt|*.txt"
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As 1
Do Until EOF(1)
Line Input #1, stri
List1.AddItem stri
Loop
Close #1
For u = 0 To List1.ListCount - 1
If InStr(List1.List(u), "《") <> 0 Then
For i = 0 To List2.ListCount - 1
If List2.List(i) = Mid(List1.List(u), InStr(List1.List(u), "《") + 1, InStr(List1.List(u), "》") - InStr(List1.List(u), "《") - 1) Then
panduan = panduan + 1
End If
Next
If panduan = 0 Then
List2.AddItem Mid(List1.List(u), InStr(List1.List(u), "《") + 1, InStr(List1.List(u), "》") - InStr(List1.List(u), "《") - 1)
Else
panduan = 0
End If
End If
If InStr(List1.List(u), "(") <> 0 Then
For i = 0 To List2.ListCount - 1
If List2.List(i) = Mid(List1.List(u), InStr(List1.List(u), "(") + 1, InStr(List1.List(u), ")") - InStr(List1.List(u), "(") - 1) Then
panduan = panduan + 1
End If
Next
If panduan = 0 Then
List2.AddItem Mid(List1.List(u), InStr(List1.List(u), "(") + 1, InStr(List1.List(u), ")") - InStr(List1.List(u), "(") - 1)
Else
panduan = 0
End If
End If
Next
End Sub
你试试!!!!
Private Sub Command1_Click()
panduan = 0
CommonDialog1.Filter = "文本文档txt|*.txt"
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As 1
Do Until EOF(1)
Line Input #1, stri
List1.AddItem stri
Loop
Close #1
For u = 0 To List1.ListCount - 1
If InStr(List1.List(u), "《") <> 0 Then
For i = 0 To List2.ListCount - 1
If List2.List(i) = Mid(List1.List(u), InStr(List1.List(u), "《") + 1, InStr(List1.List(u), "》") - InStr(List1.List(u), "《") - 1) Then
panduan = panduan + 1
End If
Next
If panduan = 0 Then
List2.AddItem Mid(List1.List(u), InStr(List1.List(u), "《") + 1, InStr(List1.List(u), "》") - InStr(List1.List(u), "《") - 1)
Else
panduan = 0
End If
End If
If InStr(List1.List(u), "(") <> 0 Then
For i = 0 To List2.ListCount - 1
If List2.List(i) = Mid(List1.List(u), InStr(List1.List(u), "(") + 1, InStr(List1.List(u), ")") - InStr(List1.List(u), "(") - 1) Then
panduan = panduan + 1
End If
Next
If panduan = 0 Then
List2.AddItem Mid(List1.List(u), InStr(List1.List(u), "(") + 1, InStr(List1.List(u), ")") - InStr(List1.List(u), "(") - 1)
Else
panduan = 0
End If
End If
Next
End Sub
你试试!!!!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询