用vba来凑凑热闹,显示字母,小写字母,数字,其他字符个数- Private Sub CommandButton2_Click()
- arr = Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
- ary = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
- r = 0: s = 0: t = 0
- For i = 1 To Len([a1])
- tmp = Filter(arr, Right(Left([a1], i), 1))
-
- If IsError(Application.Match(Right(Left([a1], i), 1), arr, 0)) = False Then r = r + 1
- If UBound(tmp) > -1 Then s = s + 1
- If IsError(Application.Match(Right(Left([a1], i), 1), ary, 0)) = False Then t = t + 1
-
- Next
- MsgBox ("数字有" & t & "个" & "," & "字母有" & r & "个" & "," & "其中小写字母有" & s & "个" & "," & "其他字符有" & Len([a1]) - r - t & "个")
- End Sub
复制代码 |