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

¶W·s¤â´`¨D¦U¦ì¤j¤j´£¨ÑWscript.Echo µ²ªG¿é¥X¦¨txt¤èªk

¶W·s¤â´`¨D¦U¦ì¤j¤j´£¨ÑWscript.Echo µ²ªG¿é¥X¦¨txt¤èªk

¥»©«³Ì«á¥Ñ linnetkill ©ó 2019-12-24 23:37 ½s¿è

DATA.txt
00001caseD-123456789012345678901234567890
00001caseD-1234567890123456789
00001caseD-1234567890123456
00001caseD-123456789012345678901234
¿é¥XÅܦ¨¤U¦C,¥uÅܧó¨C¦C«e¤­­Ó¦r¤¸¨ä¥Lºû«ù¤£ÅÜ
00001caseD-123456789012345678901234567890
00002caseD-1234567890123456789
00003caseD-1234567890123456
00004caseD-123456789012345678901234

§Ú¤Wºô§ä¤F­×§ï¤F¤@³¡¤À,¦ý¬O¿é¥X¦¨txt¤è¦¡°µ¤£¥X,¬O§_¤j¤j¥i¥HÀ°§Ú¬Ý¤@¤U
¤U­z¬Oµ{¦¡³¡¤À
Set objRegEx = CreateObject("VBScript.RegExp")
Dim arrFileLines()
ABC = ""
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\data.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.Global = True
objRegEx.IgnoreCase = True
objRegEx.Pattern = "\d{i}"
For l = LBound(arrFileLines) to UBound(arrFileLines) Step 1
strNewString = objRegEx.Replace(arrFileLines(l),"0000" & (l+1) )'¦ì¤¸¼Æ¥[¤W°j°é¼Æ
ABC = ABC & strNewString & chr(10)
Next
Wscript.Echo ABC

        ÀR«ä¦Û¦b : ÀR§¤±`®¦¤v¹L¡B¶¢½Í²ö½×¤H«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD