VB输入一个字符串,统计其中字母a的出现次数,用过程实现
2个回答
展开全部
Private Sub Command1_Click()
Dim istr As String
istr = InputBox("", "", "abcdeaa")
Num istr
End Sub
Private Sub Num(ByVal istr As String)
Dim i As Integer
Dim N As Integer
For i = 1 To Len(istr)
If Mid(istr, i, 1) = "a" Then N = N + 1
Next
MsgBox N
End Sub
Dim istr As String
istr = InputBox("", "", "abcdeaa")
Num istr
End Sub
Private Sub Num(ByVal istr As String)
Dim i As Integer
Dim N As Integer
For i = 1 To Len(istr)
If Mid(istr, i, 1) = "a" Then N = N + 1
Next
MsgBox N
End Sub
2013-05-13
展开全部
Private Sub Command1_Click()
Dim myTempstr As String
myTempstr = InputBox("请输入一串字符", "", "asdfsgewqeuqa")
MsgBox Len(myTempstr) - Len(Replace(myTempstr, "a", ""))
End Sub
Dim myTempstr As String
myTempstr = InputBox("请输入一串字符", "", "asdfsgewqeuqa")
MsgBox Len(myTempstr) - Len(Replace(myTempstr, "a", ""))
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |