welcome to 's blog...


公告

我的分类(专题)

日志更新

最新评论

留言板

链接

搜索


Blog信息




跟网友讨论的脚本
aku1 发表于 2008-6-30 9:40:17

Const ForReading = 1
Const ForWriting = 2

Dim oFSO,oF,i,j,strline,strnewText,strnewText1
array1=array("111 bbb","222 aab","333 aaa","444 bbb","555 ccc","666 b")
ScriptPath="C:\FSO"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oF = oFSO.CreateTextFile(ScriptPath & "file.txt")
for i=0 to 5
 
oF.Writeline(array1(i)& vbCrLf)
next

oF.close

' 包含 "b"。

Set objFile = oFSO.OpenTextFile(ScriptPath & "file.txt", ForReading)

Do Until objFile.AtEndOfStream
    strLine = objFile.ReadLine
 if instr(1,strline,"b",1)>0 then

    strNewText = strnewtext&strLine & vbCrLF
end if
   
Loop

oF.close

Set objFile = oFSO.OpenTextFile("C:\FSo\file.txt", ForWriting)

objFile.WriteLine strNewText

objFile.Close

' 包含 "b"且两两显示

Set objFile = oFSO.OpenTextFile("C:\FSo\file.txt", ForReading)

Do Until objFile.AtEndOfStream
    strLine=objFile.ReadLine
    strline=replace(strline," ",",")
    strNewText1 = strnewtext1&strLine & ","
   
loop
    MyArray=split(strNewText1,",",-1,1)
 
oF.close

Set objFile = oFSO.OpenTextFile("C:\FSo\file1.txt", ForWriting)

For i = 1 to Ubound(myArray)/4

 
objFile.WriteLine myArray(4*i-3) &" " &myArray(4*i-1)
 
Next


objFile.Close


阅读全文 | 回复(1) | 引用通告 | 编辑


Re:跟网友讨论的脚本
beginner(游客)发表评论于2008-6-30 23:01:52

http://www.loveunix.net/thread-86357-3-1.html
个人主页 | 引用 | 返回 | 删除 | 回复


发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题:



Powered by Oblog.