我是想做一道题目,我的思路是输入一段文章,将其中的字符一个一个放到数组中,然后我先从文章里面随便取一个出来,如果是空格,那么我看后面那个字符,如果是大写,那么我把取出来的那个字符放回到它在数组中所在的位置,接着,如果后面那个不是大写,那么我就将它改为小写,然后将改好后的东西代替它在数组中原来的位置,最后将数组打印出来。能不能帮我看下,我运行的时候它说我下标越界面
题目:输入一段文章,将每个单词首字母从小写改为大写
Private Sub Command1_Click()
Dim i, tot, dz, ss As Integer, zf, hs, fs, ms, a() As String
tot = Len(Text1.Text)
For i = 1 To tot
zf = Mid(Text1, i, 1)
If zf = " " Or zf = "," Then
hs = Mid(Text1, i + 1, 1)
If (Asc(hs) > 65) And (Asc(hs) < 90) Then
a(i + 1) = a(i + 1)
End If
ss = Asc(hs) - 32
a(i + 1) = Chr(ss)
End If
Next i
For i = 1 To tot
Print a(i)
Next i
End Sub