本帖最后由 pcl_test 于 2015-5-10 10:54 编辑
vbs 1M大小的文本用时8秒±- Dim fso,File1,File2
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set Reg = CreateObject("vbscript.Regexp")
- Set File1= fso.OpenTextFile(".\测试.txt", 1 , True)
- Set File2 = fso.CreateTextFile(".\结果.txt", 2 ,False)
- Do While File1.AtEndOfStream <> True
- str=File1.ReadLine
- Reg.Global = True
- Reg.Pattern = "[^a-zA-Z0-9\u4E00-\u9FA5]"
- str = Reg.Replace(str, "")
- For i=1 to len(str)
- word=mid(str,i,1)
- File2.WriteLine word
- Next
- loop
- File1.Close
- File2.Close
- MsgBox "完成!"
复制代码
|