vb怎么统计有几个数字 vb字符串统计
1、启动VB新建工程1,在form1的合适位置画出3个Label框、2个Text框以及1个Command按钮(可以预先对各控件的Caption等属性进行修改).2、双击“统计”(即.
vb统计数字字符个数dim x as integer, str as string, y as integer str = text1.text for i = 1 to len(str) a = mid(str, i, 1) if isnumeric(a) then x = x + 1 else: y = y + 1 end if next text2.text = "数字个数为:" & x text3.text = "字符个数为:" & y
VB中怎样统计一组数中每个数字出现的个数Private Sub Command3_Click() Dim a(100), b(100), c(10) As Integer Randomize For i = 1 To 100 a(i) = Int(Rnd * 100) Print a(i); If i Mod 10 = 0 Then Print Next i For i = 1 To .
vb如何统计数字的个数,如124,67,98,253,结果统计个数为4个?假设数据存放在字符串变量里;Dim ss as stringDim d() as stringDim n as integerss = "124,67,98,253"d = Split(ss,",") '使用VB的Split函数,以逗号作为分隔符号,拆分数据存放到数组d 里n = UBound(d) + 1Print “一共有:” & n & "个数字"注意:数组d的下标从0开始编号!!!!即:d(0) = "124"d(1) = "67"d(2) = "98"d(3) = "253"
vb编程,输入一个字符串,分别统计其中有多少个字母、多少个数字、多.dim num1 as integer,num2 as integer dim num3 as integer,num4 as integer,num5 as . "个" print "数字字符有:";num3;"个" print "空格字符有:";num4;".
vb统计出现的个数Private Sub Command1_Click() s = Text1.Text l = Len(Text1.Text) For i = 1 To l If Mid(s, i, 1) = "E" Then ne = ne + 1 If Mid(s, i, 1) = "F" Then nf = nf + 1 If Mid(s, i, 1) = "G" Then ng = ng + 1 If Mid(s, i, 1) = "H" Then nh = nh + 1 Next i Print "E =" & ne Print "F =" & nf Print "G =" & ng Print "H =" & nh End Sub
vb作业求助,怎么统计不同数的个数,谢谢各位大神了以下的程序,可以统计,全年级有几个不同的成绩:Private Sub Command1_Click() Dim a(100) As Integer n = Val(InputBox("有几个成绩:")) For i = 1 To n x = Val(InputBox("第" & i & "个成绩=")) a(x) = 1 Next i k = 0 For i = 0 To 100 k = k + a(i) Next i MsgBox ("不同的成绩共有 " & k & " 个") End Sub
vb如何统计一堆数字?解析循环遍历判断
VB 统计个数private sub form_load() showdim i as integeropen "统计.txt" for input as #1do while not eof(1) line input #1, tempstr '必须有一个操作语句!!!!i = i + 1loopclose #1print i end sub
如何用VB统计汉字个数简单,比如有个text1,只要 a=len(text1.text) a这个变量就是text1里汉字的个数.