试图让它改变解析字符串段的第一个字母的大小写。因此,如果用户在 txtName 中输入“JOHN WAYNE DOE”,那么它将显示“John Wayne Doe” return 是“JOHN WAYNE DOE” 我认为这是一个逻辑错误,因为众所周知我经常这样做,只是不知道我在哪里犯了错误。
Dim name As String = txtName.Text
name = name.Trim
Dim names() As String = name.Split(CChar(" "))
Dim firstName As String = names(0)
Dim middleName As String = names(1)
Dim lastName As String = names(2)
Dim firstLetters1 As String = firstName.Substring(0, 1).ToUpper
Dim otherletters1 As String = firstName.Substring(1).ToLower
Dim firstLetters2 As String = middleName.Substring(0, 1).ToUpper
Dim otherletters2 As String = middleName.Substring(1).ToLower
Dim firstletters3 As String = lastName.Substring(0, 1).ToUpper
Dim otherletters3 As String = lastName.Substring(1).ToLower
MessageBox.Show("First Name: " & firstName & vbCrLf & "Middle Name: " & middleName & vbCrLf & "Last Name: " & lastName)