怎么用vb编写“给出一个字符串,统计这个字符串里面英文字母、数字字符和其他字符的个数。”这个程序

2024-12-02 13:05:12
推荐回答(1个)
回答1:

Private Sub Command1_Click()
n = 0
m = 0
k = 0
l = 0
aa = 0
bb = Text1
Do Until Len(bb) = 0
aa = Asc(bb)
bb = Right(bb, Len(bb) - 1)
Print aa
If 97 <= aa And aa <= 122 Then
n = n + 1
Else
If 65 <= aa And aa <= 90 Then
m = m + 1
Else
If 48 <= aa And aa <= 57 Then
k = k + 1
Else
l = l + 1
End If
End If
End If
Loop
Picture1.Print "小写字母为"; n; "个"
Picture1.Print "大写字母为"; m; "个"
Picture1.Print "数字为"; k; "个"
Picture1.Print "特殊符号为"; l; "个"
End Sub
你再调调