本帖最后由 xiaochuan 于 2012-11-29 18:59 编辑
问大家一下,比如把第一位带0的都杀掉,我用数组完成了,但是反应相当慢,求一个好点的思路~~多谢!!!#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
GUICreate('',500,600)
$Edit1=GUICtrlCreateEdit("",10,30,200,481,$WS_VSCROLL,0)
$Input1=GUICtrlCreateInput("0",240,100,40,50)
$Button1 = GUICtrlCreateButton("杀掉第一位", 312, 100, 107, 50)
GUISetState(@SW_SHOW)
_all()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $button1
_kill()
EndSwitch
WEnd
Func _all()
Local $i,$j,$k,$l,$m,$str=''
For $i=0 To 4
For $j=0 To 4
For $k=0 To 4
For $l=0 To 4
For $m=0 To 4
$str&=$i&$j&$k&$l&$m&' '
Next
Next
Next
Next
Next
$str=StringLeft($str,StringLen($str)-1)
GUICtrlSetData($Edit1,$str)
EndFunc
Func _kill()
Local $i,$j,$num,$tmparr[1]=['a']
$num=GUICtrlRead($Input1)
$arr=StringSplit(GUICtrlRead($Edit1),' ')
For $i=1 To $arr[0]
If StringLeft($arr[$i],1)==$num Then
_ArrayAdd($tmparr,$i)
EndIf
Next
For $j=UBound($tmparr)-1 To 1 Step -1
_ArrayDelete($arr,$tmparr[$j])
Next
GUICtrlSetData($Edit1,_ArrayToString($arr,' ',1))
EndFunc
|