请问高手们如何判断多个文本文件中是否包含有指定内容?
请问高手们如何判断多个文本文件中是否包含有指定内容,,例如现有一个文本文件中包含有11111,22222,33333,此文件名为a.txt,有四个文件如1.txt,2.t...
请问高手们如何判断多个文本文件中是否包含有指定内容,,例如现有一个文本文件中包含有11111,22222,33333,此文件名为a.txt,有四个文件如1.txt,2.txt,3.txt,4.txt ,判断四个文件中是否包含a.txt中的字符,如果有包含的,则删除a.txt中包含的字符.如果能帮助我的,全部分送上!
vb方面的代码,或是有这方面的软件也可以 展开
vb方面的代码,或是有这方面的软件也可以 展开
6个回答
展开全部
如果是想找一部分特定内容的话:打开记事本Ctrl+F输入要找的关键字搜索
如果是想在多个TXT格式里面找出你所要的标题的话:打开我的电脑点击左上角的放大镜搜索TXT三个字母,然后一会就出先所有的TXT的格式的文件
建议你把这两个结合用吧
如果是想在多个TXT格式里面找出你所要的标题的话:打开我的电脑点击左上角的放大镜搜索TXT三个字母,然后一会就出先所有的TXT的格式的文件
建议你把这两个结合用吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
等下哦,程序帮你赶……
我是以一个函数的方式写出来
有什么要求可以提出来,在程序没有的写完之前
Public Function DelInTexts(Path As String, SourceText As String, Optional ReplacesCount As Long) As Lon
Dim iFileList() As String
'A Array For Path's All Text
Dim iPath As String
'Save The Path
Dim iFileCount As Long
Dim tFile As String
tFile = Dir(Replace(Path & "\*.txt", "\\", "\"))
'Init The Dir
'Next Get All File In Path
Do While tFile = "" ' when tfile = null exit loop
'loop for find all text' in path .when "redim" running ,Preserve the array
iFileCount = iFileCount + 1
ReDim Preserve iFileList(0 To iFileCount)
iFileList(iFileCount) = Path & tFile
'next
tFile = Dir
Loop
Dim sByte() As Byte
Open SourceText For Binary As #1
ReDim sByte(0 To LOF(1))
Get #1, , sByte()
Close #1
'Get Need Replace's Text
'Dim nFile As String
For i = LBound(iFileList) + 1 To UBound(iFileList)
Dim iFileByte() As Byte
Open iFileList(i) For Binary As #1
ReDim iFileByte(0 To LOF(1))
Get #1, , iFileByte()
iFileByte() = StrConv(Replace(iFileByte(), sByte, 0, , , vbBinaryCompare), vbFromUnicode)
Put #1, , iFileByte()
Close #1
ReplacesCount = ReplacesCount + 1
Next
End Function
我是以一个函数的方式写出来
有什么要求可以提出来,在程序没有的写完之前
Public Function DelInTexts(Path As String, SourceText As String, Optional ReplacesCount As Long) As Lon
Dim iFileList() As String
'A Array For Path's All Text
Dim iPath As String
'Save The Path
Dim iFileCount As Long
Dim tFile As String
tFile = Dir(Replace(Path & "\*.txt", "\\", "\"))
'Init The Dir
'Next Get All File In Path
Do While tFile = "" ' when tfile = null exit loop
'loop for find all text' in path .when "redim" running ,Preserve the array
iFileCount = iFileCount + 1
ReDim Preserve iFileList(0 To iFileCount)
iFileList(iFileCount) = Path & tFile
'next
tFile = Dir
Loop
Dim sByte() As Byte
Open SourceText For Binary As #1
ReDim sByte(0 To LOF(1))
Get #1, , sByte()
Close #1
'Get Need Replace's Text
'Dim nFile As String
For i = LBound(iFileList) + 1 To UBound(iFileList)
Dim iFileByte() As Byte
Open iFileList(i) For Binary As #1
ReDim iFileByte(0 To LOF(1))
Get #1, , iFileByte()
iFileByte() = StrConv(Replace(iFileByte(), sByte, 0, , , vbBinaryCompare), vbFromUnicode)
Put #1, , iFileByte()
Close #1
ReplacesCount = ReplacesCount + 1
Next
End Function
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用什么语言?以下用VB实现,如果想做成多行文本内容,可用动态数组来完成。
Private Sub CommandButton1_Click()
Dim txtStr As String
Dim txtStr1 As String
Dim txtStr2 As String
Dim txtStr3 As String
Dim txtStr4 As String
Open "c:\a.txt" For Input As #1
Input #1, txtStr
Close #1
Open "c:\1.txt" For Input As #1
Input #1, txtStr1
Close #1
Open "c:\2.txt" For Input As #1
Input #1, txtStr2
Close #1
Open "c:\3.txt" For Input As #1
Input #1, txtStr3
Close #1
Open "c:\4.txt" For Input As #1
Input #1, txtStr4
Close #1
txtStr1 = Replace(txtStr1, txtStr, "")
txtStr2 = Replace(txtStr2, txtStr, "")
txtStr3 = Replace(txtStr3, txtStr, "")
txtStr4 = Replace(txtStr4, txtStr, "")
Open "c:\1.txt" For Output As #2
Print #2, txtStr1
Close #2
Open "c:\2.txt" For Output As #2
Print #2, txtStr2
Close #2
Open "c:\3.txt" For Output As #2
Print #2, txtStr3
Close #2
Open "c:\4.txt" For Output As #2
Print #2, txtStr4
Close #2
End Sub
Private Sub CommandButton1_Click()
Dim txtStr As String
Dim txtStr1 As String
Dim txtStr2 As String
Dim txtStr3 As String
Dim txtStr4 As String
Open "c:\a.txt" For Input As #1
Input #1, txtStr
Close #1
Open "c:\1.txt" For Input As #1
Input #1, txtStr1
Close #1
Open "c:\2.txt" For Input As #1
Input #1, txtStr2
Close #1
Open "c:\3.txt" For Input As #1
Input #1, txtStr3
Close #1
Open "c:\4.txt" For Input As #1
Input #1, txtStr4
Close #1
txtStr1 = Replace(txtStr1, txtStr, "")
txtStr2 = Replace(txtStr2, txtStr, "")
txtStr3 = Replace(txtStr3, txtStr, "")
txtStr4 = Replace(txtStr4, txtStr, "")
Open "c:\1.txt" For Output As #2
Print #2, txtStr1
Close #2
Open "c:\2.txt" For Output As #2
Print #2, txtStr2
Close #2
Open "c:\3.txt" For Output As #2
Print #2, txtStr3
Close #2
Open "c:\4.txt" For Output As #2
Print #2, txtStr4
Close #2
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-06-20
展开全部
请给出各个文件中“字符”的存放格式,最好能给出各文件内容的例子,这种问题应该是很简单的问题。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
要程序还是要软件?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询