#include <Array.au3>
$sStr = "12:23 9:01 02:03 23:59 32:24 20:60 25:32 12:1 8:61"
$aArray = StringRegExp($sStr, "(\d+:\d+)", 3) ; ==> 下划线处该如何写?
For $i = 0 To UBound($aArray) - 1
$m = StringSplit($aArray[$i], ":")
If $m[1] > 23 Or $m[2] > 59 Then $aArray[$i] = ""
Next
$aArray = _Array_MElement($aArray, "")
_ArrayDisplay($aArray)
Func _Array_MElement($HArray, $Element, $NewElement = "", $Flag = "")
If Not IsArray($HArray) Then Return 0
If $Flag = "" Or $Flag = 0 Then
Local $m = 0, $n = 0
Local $LArray = $HArray
For $i = 0 To UBound($HArray) - 1
If $LArray[$i] = $Element Then
$m = $m + 1
Else
$HArray[$n] = $LArray[$i]
$n = $n + 1
EndIf
Next
For $i = (UBound($HArray) - 1) To (UBound($HArray) - $m) Step -1
_ArrayDelete($HArray, $i)
Next
ElseIf $Flag = 1 Then
For $i = 0 To UBound($HArray) - 1
If $HArray[$i] = $Element Then
$HArray[$i] = $NewElement
EndIf
Next
EndIf
Return $HArray
EndFunc ;==>_Array_MElement
|