本帖最后由 love5173 于 2011-5-2 14:39 编辑
回复 42# easefull
你的时间点取错了,速度应该是1500ms
不过你的处理方式很特别,能讲讲吗
#include <Array.au3>
Local $oFile, $sText
$iTime = TimerInit()
$oFile = FileOpen("shex.tnf", 16)
$sText = FileRead($oFile)
$sText = StringRegExpReplace($sText, '(.{2})', '\1' & " ")
FileClose($oFile)
Local $SearchKey = "000001"
;Local $iTime = TimerInit()
Local $sRegExp = _
'3\d\s3\d\s3\d\s3\d\s3\d\s3\d\s' & _
'00\s00\s00\s' & _
'..\s' & _
'00\s00\s00\s00\s' & _
'..\s..\s' & _
'00\s00\s00\s00\s00\s00\s00\s00\s' & _
'.*?(?:00\s)'
Local $asResult = StringRegExp($sText, $sRegExp, 3)
;~ _ArrayDisplay($asResult)
Local $sResult = ""
Local $sRegExp = _
'(3\d\s3\d\s3\d\s3\d\s3\d\s3\d\s)' & _
'00\s00\s00\s' & _
'..\s' & _
'00\s00\s00\s00\s' & _
'..\s..\s' & _
'00\s00\s00\s00\s00\s00\s00\s00\s' & _
'(.*?)(?:00\s)'
For $i = 0 To UBound($asResult) - 1 Step 1
$asTemp = StringRegExp($asResult[$i], $sRegExp, 3)
$sResult &= BinaryToString('0x' & StringStripWS($asTemp[0], 8)) &@TAB& BinaryToString('0x' & StringStripWS($asTemp[1], 8)) & @CRLF
Next
;~ ClipPut($sResult)
;MsgBox(0,"",$sResult)
If FileExists("Result.txt") Then FileDelete("Result.txt")
FileWrite("Result.txt", $sResult)
;~ MsgBox(4096, "", TimerDiff($iTime))
If $SearchKey Then
$asResult = StringRegExp(FileRead("Result.txt"), '.*' & $SearchKey & '.*?\v', 3)
If @error Then
MsgBox(0, "查询结果", "关键字: " & "$SearchKey" &@CRLF& "用时: " & TimerDiff($iTime) & "毫秒" &@CRLF&@CRLF& "没找到相似的结果!")
Else
$sResult = ""
For $i = 0 To UBound($asResult) - 1 Step 1
$sResult &= $asResult[$i] & @CRLF
Next
MsgBox(0, "查询结果", "关键字: " & $SearchKey &@CRLF& "用时: " & TimerDiff($iTime) & "毫秒" &@CRLF&@CRLF& $sResult)
EndIf
EndIf
Exit
这个才是你的程序的用时 |