2个回答
展开全部
Private Sub Command1_Click()
Dim str As String, strTmp As String, intN As Integer, intM As Integer
Dim intX As Integer, intY As Integer, intZ As Integer, intW As Integer
str = Text1.Text
intN = Len(str)
For intM = 1 To intN
strTmp = UCase(Mid(str, intM, 1))
If IsNumeric(strTmp) Then '数字
intX = intX + 1
ElseIf Asc(strTmp) > 64 And Asc(strTmp) < 91 Then '字母
intY = intY + 1
ElseIf strTmp = " " Then '空格
intZ = intZ + 1
Else '其它
intW = intW + 1
End If
Next
Text2.Text = "数字个数为:" & intX
Text3.Text = "字母个数为:" & intY
Text4.Text = "空格个数为:" & intZ
Text5.Text = "特殊字符个数为:" & intW
End Sub
Dim str As String, strTmp As String, intN As Integer, intM As Integer
Dim intX As Integer, intY As Integer, intZ As Integer, intW As Integer
str = Text1.Text
intN = Len(str)
For intM = 1 To intN
strTmp = UCase(Mid(str, intM, 1))
If IsNumeric(strTmp) Then '数字
intX = intX + 1
ElseIf Asc(strTmp) > 64 And Asc(strTmp) < 91 Then '字母
intY = intY + 1
ElseIf strTmp = " " Then '空格
intZ = intZ + 1
Else '其它
intW = intW + 1
End If
Next
Text2.Text = "数字个数为:" & intX
Text3.Text = "字母个数为:" & intY
Text4.Text = "空格个数为:" & intZ
Text5.Text = "特殊字符个数为:" & intW
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询