回复 1# 49666684
用了正则.
$Str = '192.168.0.1|Amd|9600GT|%192.168.0.1|Amd|9600GT|%192.168.0.3|Intel|GTX250|%'
$Test = StringRegExp($Str, '(.*?)%', 3)#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $listview, $button, $input1, $msg, $Test, $Str
Local $item[3]
GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF)
$listview = GUICtrlCreateListView("列 1 |列 2|列 3 ", 10, 10, 200, 150);
$button = GUICtrlCreateButton("Button", 40, 170, 120, 20)
GUISetState()
$Str = '192.168.0.1|Amd|9600GT|%192.168.0.1|Amd|9600GT|%192.168.0.3|Intel|GTX250|%'
$Test = StringRegExp($Str, '(.*?)%', 3)
For $i = 0 To UBound($Test) - 1
MsgBox(0, $i + 1, $Test[$i])
$item[$i] = GUICtrlCreateListViewItem($Test[$i], $listview)
_GUICtrlListView_SetColumnWidth($listview, $i, $LVSCW_AUTOSIZE)
Next
Do
$msg = GUIGetMsg()
Select
Case $msg = $button
MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc ;==>Example
|