输入一些英文语句,使每个单词的第一个字母变成大写
问题描述:
输入一些英文语句,使每个单词的第一个字母变成大写
VB写
答
标点符号你还 可以添加
Private Sub Command1_Click()
Dim a,a1,s1,s2,b()
f = Array(",",",".",":",";","!")
a = Text1
For j = 0 To UBound(f)
a1 = Split(a,f(j))
ReDim b(UBound(a1))
For i = 0 To UBound(a1)
s1 = Left(a1(i),1)
s1 = UCase(s1)
s2 = Right(a1(i),Len(a1(i)) - 1)
b(i) = s1 & s2
Next i
For i = 0 To UBound(a1)
txt = txt & b(i) & f(j)
Next i
a = Left(txt,Len(txt) - 1)
txt = ""
Next j
Text1 = a
End Sub
Private Sub Form_Load()
Text1 = "sad,aaa?bd!fds;sdf:sdf"
End Sub