菜鸟求助VB

来源:百度知道 编辑:UC知道 时间:2024/06/11 20:54:24
请高手帮我看一下这段程序
Private Sub Command1_Click()
Dim a(1 To 26) As Integer, textlen As Integer
Dim i As Integer, j As Integer, c As String * 1
Label1.Caption = ""
textlen = Len(Text1)
For i = 1 To textlen
c = UCase(Mid(Text1, i, 1))
If (c >= "A" And c <= "Z") Then
j = Asc(c) - 65 + 1
a(j) = a(j) + 1
End If
Next i
For j = 1 To 26
If a(j) > 0 Then
Label1.Caption = Label1.Caption & Chr$(j + 64) & "=" & a(j) & ""
End If
Next j
End Sub
其中的
For i = 1 To textlen
c = UCase(Mid(Text1, i, 1))
If (c >= "A" And c <= "Z") Then
j = Asc(c) - 65 + 1
a(j) = a(j) + 1
End If
Next i
是什么意思啊

For i = 1 To textlen '从1循环到textlen
c = UCase(Mid(Text1, i, 1)) 'c =text1内字符串的第一个字符并转换成大写
If (c >= "A" And c <= "Z") Then '如果C在A-Z范围内那么
j = Asc(c) - 65 + 1
a(j) = a(j) + 1
End If
Next i

剩下的应该不用我说了吧