标题: 文本控制与字符串处理! [打印本页] 作者: dycadrtf 时间: 2008-9-25 15:00 标题: 文本控制与字符串处理! 一个text文本,里面内容类似与dfsf,dfgdf,dfgdf,dfg,dfgfd,et,ret
现在我想经过处理保存到另一个text中。形式为dfsf,
dfgdf
dfgdf
dfg
dfgfd
et
ret
如何?作者: rcpp 时间: 2008-9-25 15:03
readline,split,write line作者: dycadrtf 时间: 2008-9-25 15:27 作者: dycadrtf 时间: 2008-9-25 15:48
Dim fso,myfile,Allstr
Set fso=CreateObject("scripting.FileSystemObject")
If fso.FileExists("C:\text.txt") then
Set myfile = fso.openTextFile("C:\text.txt",1,false)
Else
ReadLine = "文件不存在"
End If
Allstr=myfile.ReadAll()
myfile.Close()
set myfile = nothing
set fso = Nothing
Dim MyArray, Msg,str1
MyArray = Split(Allstr, ",", -1, 1)
MsgBox UBound(MyArray)
For i = 0 To UBound(MyArray)
str1=str1+MyArray(i) & Chr(13) & Chr(10)
Next
dim fso1, f
set fso1 =CreateObject("scripting.FileSystemObject")
set f = fso1.OpenTextFile("C:\test1.txt", 2, true)
f.Write(str1)
f.Close()
set f = nothing
set fso1 = nothing