焦点报道:统计字符串中出现的数字字符的个数和数的个数_01 统计数字字符个数
来源:科学教育网    时间:2023-04-21 12:14:34


(资料图)

现如今大家都会选择在网络上汲取相关知识内容,比如统计字符串中出现的数字字符的个数和数的个数_01 统计数字字符个数,为了更好的解答大家的问题,小编也是翻阅整理了相应内容,下面就一起来看一下吧!

今天小编肥嘟来为大家解答以上的问题。统计字符串中出现的数字字符的个数和数的个数,01 统计数字字符个数相信很多小伙伴还不知道,现在让我们一起来看看吧!

1、Private Sub Command1_Click() Dim a(1 To 30) Dim c(0 To 9) Dim i As Integer Picture1.Cls For i = 1 To 30 a(i) = Mid(Text1.Text, i, 1) Next i For i = 0 To 9 c(i) = 0 Next i CountN a, c For i = 0 To 9 Picture1.Print "数字" & i & ":" & c(i) & "次" Next i End Sub Private Sub Form_Load() Dim i As Integer Command1.Caption = "统计" Randomize Timer Text1.Text = "" For i = 1 To 30 Text1.Text = Text1.Text & Int(Rnd() * 10) Next i End Sub Sub CountN(a(), count()) Dim i As Integer For i = LBound(a) To UBound(a) count(Val(a(i))) = count(Val(a(i))) + 1 Next i End Sub。

关键词:

X 关闭

X 关闭