将首字母转成大写输出

默认分类 未结 1 1906
①岁时は特拽
①岁时は特拽 2023-03-16 22:00
相关标签:
1条回答
  • 2023-03-16 22:26

    设计一个函数吧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

    相反的转换一下把。

    0 讨论(0)
提交回复