Mã:
Function GetCanValue(ByVal str As String) As String
Dim reg As Object
Dim s As String, op As String
Dim Match, Matches
Set reg = CreateObject("VBScript.RegExp")
With reg
.Pattern = "(\s)([0-9a-f]{2})(\s)"
.IgnoreCase = True
.Global = True
End With
Set Matches = reg.Execute(str)
s = ""
op = ""
For Each Match In Matches
s = Match.Value
op = op & s
If s = "" Then Exit Function
Next Match
GetCanValue = op
Set reg = Nothing
End Function
Sub vidu()
Dim s As String
s = "368.752793 8 48A Rx d 8 AE 68 77 01 60 01 20 C4 Length = 111111 BitCount = 111 ID = 1246"
s = GetCanValue(s)
MsgBox s
End Sub
Hiện tại kết quả là: AE 77 60 20
Ai biết xin mách dùm!