ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¨D±Ï vbs¿é¥XtxtÀɮ׮榡µ{¦¡­×¥¿

[µo°Ý] ¨D±Ï vbs¿é¥XtxtÀɮ׮榡µ{¦¡­×¥¿


¤W¹Ï¬°¿Ã¹õ¿é¥X

¦¹¹Ï¬°¿é¥X¬°txtÀɮ׮ɪº®æ¦¡,»P¿Ã¹õ¿é¥X®æ¦¡¤£¤@­P
¤U¬°µ{¦¡½X
­n¦p¦ó¦btxtÀɮ׿é¥X»P¿Ã¹õ¿é¥X¤@¼Ë
¥i¥HÀ°§Ú¬Ý¤@¤UÀɮ׿é¥Xµ{¦¡­n¦p¦ó­×§ï
Set objRegEx = CreateObject("VBScript.RegExp")
Dim arrFileLines()
AAA = ""
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\input.txt", 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close

Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "\d{5}"
For l =  LBound(arrFileLines) to UBound(arrFileLines)
if l <10 then
strNewString = objRegEx.Replace(arrFileLines(l),"0000" & (l+1) )
AAA = AAA & strNewString & chr(10)
else
strNewString = objRegEx.Replace(arrFileLines(l),"000" & (l+1) )
AAA = AAA & strNewString & chr(10)
end if
next

Wscript.Echo AAA
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("d:\outfile.txt", True)
MyFile.WriteLine(AAA)
MyFile.Close

´«¦æ§ï¦¨chr(10)+chr(13) ¸Õ¸Õ

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD