#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $jishu[4],$chun,$qukuan
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Label1 = GUICtrlCreateLabel("存款:", 128, 104, 136, 17)
$Label2 = GUICtrlCreateLabel("提款:", 128, 152, 136, 17)
$Label3 = GUICtrlCreateLabel("负盈利:", 128, 208, 156, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$str="存款 test TB 20"&@CRLF & _
"提款 test TB 200"&@CRLF & _
"存款 test TB 50"&@CRLF & _
"存款 test TB 30"&@CRLF & _
"存款 test TB 50"&@CRLF & _
"存款 test TB 50"&@CRLF & _
"存款 test TB 20"&@CRLF & _
"存款 test TB 20"&@CRLF & _
"存款 test TB 50"&@CRLF & _
"提款 test TB 100"&@CRLF & _
"存款 test TB 30"
$str1 = StringRegExp($str, '[a-zA-Z\d\x{4e00}-\x{9fa5}]+',3)
If Not @error Then
ReDim $jishu[UBound($str1) / 4][4]
For $i = 0 To UBound($jishu) - 1
$jishu[$i][0] = $str1[$i * 4] ;存取款
$jishu[$i][1] = $str1[$i * 4+3] ;发生的金额
If StringInStr($jishu[$i][0], "存") Then
$chun += $jishu[$i][1]
Else
$qukuan += $jishu[$i][1]
EndIf
Next
GUICtrlSetData($Label1, "存款:" & $chun)
GUICtrlSetData($Label2, "提款:" & $qukuan)
GUICtrlSetData($Label3, "负盈利:" & $chun - $qukuan)
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
感谢群友fuldho与ACN~seniors数组相加的帮助! |