|
发表于 2014-10-7 08:58:06
|
显示全部楼层
#include <Array.au3>
$fhandle = FileOpen(@ScriptDir & "\test.txt")
$buf = FileRead($fhandle)
FileClose($fhandle)
;MsgBox(0, "buf read from file", $buf)
$buf = StringReplace($buf, @CRLF, "|")
;MsgBox(0, "buf replace crlf to |", $buf)
$array = StringSplit($buf, "|")
;_ArrayDisplay($array)
Local $final_data[10][10]
For $i = 1 To $array[0]
$len = StringLen($array[$i])
$j = 1
While $j < $len
If "." = StringMid($array[$i], $j, 1) Then
$j += 3
$len = StringLen($array[$i])
If $j > $len Then ExitLoop
$tmp1 = StringLeft($array[$i], $j-1)
$tmp2 = StringMid($array[$i], $j)
$array[$i] = $tmp1 & "#" & $tmp2
Else
$j += 1
EndIf
WEnd
$array_line = StringSplit($array[$i], "#")
For $j = 1 To $array_line[0]
$final_data[$i-1][$j-1] = $array_line[$j]
Next
Next
_ArrayDisplay($final_data) |
|