求一个VB编程 编程完成字符的转换。要求:将大写字母转换为小写字母,小写字母转换为大写字母,非字母字符

2025-01-19 02:59:26
推荐回答(1个)
回答1:

Private Sub Command1_Click()
s = Text1.Text
l = Len(s)
For i = 1 To l
a = Mid(s, i, 1)
If Asc(a) >= 65 And Asc(a) <= 90 Then
t = t & Chr(Asc(a) + 32)
End If
If Asc(a) >= 97 And Asc(a) <= 122 Then
t = t & Chr(Asc(a) - 32)
End If
Next i
Text2.Text = t
End Sub