¶W·s¤â´`¨D¦U¦ì¤j¤j´£¨ÑWscript.Echo µ²ªG¿é¥X¦¨txt¤èªk
- ©«¤l
- 10
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 54
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- 2000
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-7-6
- ³Ì«áµn¿ý
- 2022-1-30
|
¶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
¤Uz¬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 |
|
|
|
|
|
|