dycadrtf 发表于 2008-9-25 15:00:57

文本控制与字符串处理!

一个text文本,里面内容类似与dfsf,dfgdf,dfgdf,dfg,dfgfd,et,ret
现在我想经过处理保存到另一个text中。形式为dfsf,
dfgdf
dfgdf
dfg
dfgfd
et
ret
如何?

rcpp 发表于 2008-9-25 15:03:26

readline,split,write line

dycadrtf 发表于 2008-9-25 15:27:32

:lol :lol :lol :lol

dycadrtf 发表于 2008-9-25 15:48:03

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

???????????????????
页: [1]
查看完整版本: 文本控制与字符串处理!