设计一个函数吧VB的,其他的类似(已调试通过):Private Sub Command1_Click() Text2 = UcaseFirst(Text1)End SubFunction UcaseFirst(MyStr As String) As String If Len(MyStr) = 0 Then Exit Function UcaseFirst = UCase(Left(MyStr, 1)) & Mid(MyStr, 2)End Function
Dim Textstr As StringPrivate Sub Command1_Click()Textstr = Text1Text2 = UcaseFirst(Textstr)End SubFunction UcaseFirst(MyStr As String) As StringIf Len(MyStr) = 0 Then Exit FunctionDim Str() As StringStr = Split(MyStr, \" \")For i = 0 To UBound(Str)UcaseFirst = UcaseFirst & \" \" & UCase(Left(Str(i), 1)) & LCase(Mid(Str(i), 2))Next iEnd Function楼上的还存在一点问题
参考资料:http://yejing.gm917.net
相反的转换一下把。