Private Sub Command1_Click()
Dim s As String
Dim s1 As String
s = InputBox("请你输入一段字母")
Print s
For i = 1 To Len(s)
Select Case Mid(s, i, 1)
Case "A" To "Z"
s1 = s1 + LCase(Mid(s, i, 1))
Case "a" To "z"
s1 = s1 + UCase(Mid(s, i, 1))
Case Else
s1 = s1 + Mid(s, i, 1)
End Select
Next i
Print s1
End Sub
Private Sub Command1_Click()
Dim a As String
a = "Hellow Word!"
Dim i As Integer, x As Byte
For i = 1 To Len(a)
x = Asc(Mid(a, i, 1))
If (x >= 65 And x <= 90) Then
x = x + 32
Mid(a, i, 1) = Chr(x)
ElseIf (x >= 97 And x <= 122) Then
x = x - 32
Mid(a, i, 1) = Chr(x)
End If
Next
MsgBox a
End Sub
不难的!
Private Sub Command1_Click()
Dim i, n, t, p
n = Len(Text1.Text)
p = ""
For i = 1 To n
t = Mid(Text1.Text, i, 1)
If Asc(t) >= Asc("A") And Asc(t) <= Asc("Z") Then
p = p & Chr(Asc(t) + 32)
ElseIf Asc(t) >= Asc("a") And Asc(t) <= Asc("z") Then
p = p & Chr(Asc(t) - 32)
Else
p = p + t
End If
Next i
Text2.Text = p
End Sub