回复 1# jinefo
不会正则,原则上用正则可以很简单解决,暂扔块砖吧,谁有玉麻烦大量砸过来,再顺便祝大家新年快乐!!
Local $string = _
'FSZHB1 04 2012-11-22 1348 S000008953 BC14D02100 0 3992 0 0 0 3992' & @CRLF & _
'FSZHB1 04 2012-11-22 1552 S000008954 BC14D01599 0 128 0 0 0 128' & @CRLF & _
'FSZHB1 04 2012-11-22 1552 S000008954 BC14D99999 0 -128 0 0 0 -128' & @CRLF & _
'FSZHB1 04 2012-11-22 1554 S000008955 BC14D99999 0 -1280 0 0 0 -1280' & @CRLF & _
'FSZHB1 04 2012-11-22 1554 S000008955 BC14D02097 0 1280 0 0 0 1280' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D02087 0 3690 0 0 0 3690' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D01796 0 158 0 0 0 158' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D01579 0 248 0 0 0 248' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D99999 0 -4096 0 0 0 -.4096' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D99996 0 10000 0 0 0 10000' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D99996 0 -10000 0 0 0 -10000' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D99996 0 10000 0 0 0 10000' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D01579 0 248 0 0 0 248' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D99998 0 -4581 0 0 0 -4581' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D01796 0 158 0 0 0 158' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D01908 0 14175 0 0 0 14175'
$string = StringRegExpReplace($string, '\h+', ' ')
Local $aLine = StringSplit($string, @CRLF, 1)
Local $sFlag = '_____'
Local $aCol, $sOut_Text, $sVarName, $sCheckName
For $a = 1 To $aLine[0]
$aCol = StringSplit($aLine[$a], ' ', 1)
$sVarName = $sFlag & $aCol[5] & '_' & $aCol[8]
Assign($sVarName, 1, 2)
ConsoleWrite('var=' & $sVarName & @CRLF)
Next
For $a = 1 To $aLine[0]
$aCol = StringSplit($aLine[$a], ' ', 1)
If StringInStr($aCol[8], '-') Then
$sCheckName = $sFlag & $aCol[5] & '_' & StringReplace($aCol[8], '-', '')
Else
$sCheckName = $sFlag & $aCol[5] & '_-' & $aCol[8]
EndIf
If 0 = IsDeclared($sCheckName) Then $sOut_Text &= $aLine[$a] & @CRLF
Next
$sOut_Text = StringReplace($sOut_Text, ' ', ' ')
ClipPut($sOut_Text)
Exit
|