7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Dim reg As New RegExp
Private Sub Command1_Click()
Dim strT As String
strT = ":e8:96:6:1:9b:d:"
reg.Global = True
reg.Pattern = ":([a-zA-Z0-9])(?=:)"
MsgBox (Replace(UCase(reg.Replace(strT, ":0$1")), ":", ""))
End Sub
Private Sub Command1_Click()
Dim test As String
test = "e8:96:6:1:9b:de"
Dim tmp() As String
Dim i As Integer
Dim output As String
tmp = Split(test, ":")
For i = LBound(tmp) To UBound(tmp)
If Len(tmp(i)) < 2 Then
output = output & "0" & UCase(tmp(i))
Else
output = output & UCase(tmp(i))
End If
Next
MsgBox output
End Sub