VB在文本框中输入一个字符串,将其中的小写字符转换为大写字符,大写字符转换为小写字符,
展开全部
若文本框是text1,则
text1.text = LCase(text1.text)
或简写
text1 = LCase(text1)
text1.text = LCase(text1.text)
或简写
text1 = LCase(text1)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
a = LCase("This Is A String") ' a 的值为 "this is a string"a = UCase("This Is A String") ' a 的值为 "THIS IS A STRING"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
转换小写为大写:LCase函数,例如XX = LCase("abcd"),返回值:XX = "ABCD"
转换大写为小写:UCase函数,例如XX = UCase("ABCD"),返回值:XX = "abcd"
可以:XX = LCase(Text1.Text) 或 XX = UCase(Text1.Text),全部转换为大写或小写;如果 Text1.Text 中的大写转换为小写,小写转换为大写,需要逐字符检测并转换。
代码如下:
Private Sub Command1_Click()
Dim XX As String, YY As String, ZZ As String, AA As Integer, I As Integer
XX = Text1.Text
AA = Len(XX)
For I = 1 To AA
ZZ = Mid(XX, I, 1)
If Asc(ZZ) >= 65 And Asc(ZZ) <= 90 Then
ZZ = LCase(ZZ)
ElseIf Asc(ZZ) >= 97 And Asc(ZZ) <= 122 Then
ZZ = UCase(ZZ)
End If
YY = YY & ZZ
Next I
Text1.Text = YY
End Sub
转换大写为小写:UCase函数,例如XX = UCase("ABCD"),返回值:XX = "abcd"
可以:XX = LCase(Text1.Text) 或 XX = UCase(Text1.Text),全部转换为大写或小写;如果 Text1.Text 中的大写转换为小写,小写转换为大写,需要逐字符检测并转换。
代码如下:
Private Sub Command1_Click()
Dim XX As String, YY As String, ZZ As String, AA As Integer, I As Integer
XX = Text1.Text
AA = Len(XX)
For I = 1 To AA
ZZ = Mid(XX, I, 1)
If Asc(ZZ) >= 65 And Asc(ZZ) <= 90 Then
ZZ = LCase(ZZ)
ElseIf Asc(ZZ) >= 97 And Asc(ZZ) <= 122 Then
ZZ = UCase(ZZ)
End If
YY = YY & ZZ
Next I
Text1.Text = YY
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
百度不是廉价的回答!!有作用吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询