在Text1中输入一串大写字母组成的字符串,统计A~Z每个大写字母出现的次数,并在List1中输出。
思路提示
1. 通过循环取出每一个字符进行判断。可用a(1)~a(26)分别存放A~Z出现的次数,可通过ASC函数进行转换,如将A转换成1,B转换成2……Z转换成26。ASC(“A”)=65。
2. 通过循环输出每一个字符出现次数。可用CHR函数将1~26转换成A~Z。CHR(65)=”A”。
用vb编写程序,在文本框(text1)中输入一段文本,单机“统计”按钮,分别统 ...
Private Sub Command1_Click() For i = 1 To Len(Text1.Text) Select Case Asc(Mid(Text1.Text, i, 1)) Case 65 To 90, 97 To 122: a = a + 1 Case Is < 0: b = b + 1 End Select Next Text2.Text = a Text3.Text = bEnd Sub ...
8,运行以下程序,在文本框Text1中输入一串字符,单击命令按钮command1...
这个是vb6的 Private Sub Command1_click() Dim i As Integer, tmp As String, str As String str = "" For i = 1 To Len(Text1.Text) tmp = Mid(Text1.Text, i, 1) If tmp >= "A" And tmp <= "Z" Then str = str & tmp ElseIf str <> "" Then...
VB编写一个程序,统计输入的字符串中小写字母、大写字母、数字及其他符...
If Mid(Text1, i, 1) <> 32 Then '没空格 If 97 < Asc(Mid(Text1, i, 1)) And Asc(Mid(Text1, i, 1)) < 122 Then a = a + 1 '小写字母 If 65 < Asc(Mid(Text1, i, 1)) And Asc(Mid(Text1, i, 1)) < 90 Then b = b + 1 '大写的 If 48 < Asc(Mid(Tex...
用vb编程统计一段英文中大写字母、小写字母、空格、数字以及其他字符的...
Text2 = Text2.Text & "大写字母个数为:" & a & Chr(13) & Chr(10)Text2 = Text2.Text & "小写字母个数为:" & b & Chr(13) & Chr(10)Text2 = Text2.Text & "空格的个数为:" & c & Chr(13) & Chr(10)Text2 = Text2.Text & "数字的个数为:" & d & Chr(13...
vb中在一段字母中有大小写,怎样分别计算大.小写字母的个数
for i=1 to len(ss)s=mid(ss,i,1)if s>="A" and s<="Z" then dx=dx+1 elseif s>="a" and s<="z" then xx=xx+1 end if next msgbox "大写字母" & dx & "个" & vbcrlf & "小写字母" & xx & "个"
请教VB!!!任意输入一组字符,统计出大写字母多少个,小写字母多少个,数 ...
x + 1 Case "a" To "z"y = y + 1 Case "0" To "9"z = z + 1 Case Else End Select Next i Label1.Caption = "大写:" & x & "," & "小写:" & y & "," & "数字:" & z End Sub 运行结果见图:你的应该是变量不是全局变量,所以在其他过程中不能传递值。
VB编程:编写程序,统计一段英文中26个字母出现的频率,并按其频率从高到...
Private Sub Command1_Click() Dim s1 As String, s2 As String, t As Integer Dim sN(0 To 25) As Integer, ss(0 To 25) As Integer Open "(这里写盘符+文件名.txt)" For Input As #1 Do While Not EOF(1) Input #1, s1 s2 = s2 + s1 Loop Close #1...
...统计。文本框中输入一串字符,统计各字母出现的次数……
Private Sub Command1_Click()List1.Clear Dim a(97 To 123) As Byte, i As Integer, t As String For i = 1 To Len(Text1.Text)t = Asc(LCase(Mid(Text1.Text, i, 1)))Select Case t Case Is >= 97, Is <= 122 a(t) = a(t) + 1 Case Else a(123) = a(123) + ...
VB编程:输入一个字符串,判断其中有多少大写字母小写字母数字字符空
dim i as integer dim s as string s = InputBox("输入字符串:")for i = 1 to Len(s)if mid(s,i,1)>="A" And mid(s,i,1)<="Z" Then Num1 = Num1 + 1 elseif mid(s,i,1)>="a" And mid(s,i,1)<="z" Then Num2 = Num2 + 1 elseif mid(...
VB程序从键盘输入任意字符串,统计其中大写字母、小写字母、数字和其他...
假设字符串为 strTmp,大写计数intUc,小写计数intLc,数字计数intNum,其它计数intOth dim i as integer,chrTmp as string intUc=0 intLc=0 intNum=0 intOth=0 for i=1 to len(strTmp)chrTmp=mid(strTmp,i,1)if (chrTmp>="A") and (chrTmp<="Z") then intUc=intUc+1 elseif (...