VB 中字符串反顺序输出问题(strreverse)
PrivateSubCommand1_Click()DimiAsInteger,str2AsStringDimtAsStringu="666568677069727174...
Private Sub Command1_Click()
Dim i As Integer, str2 As String
Dim t As String
u = "6665686770697271747376757877"
For i = 1 To (Len(u)) Step 2
t = (Mid((u), i, 2))
str2 = (str2 & (Chr(t)))
Next
Text2 = str2
End Sub
结果:
Text2="BADCFEHGJILKNM"
请问怎么样才可以编程以下的呢?
Text2="ABCDEFGHIJKLMN"
Private Sub Command1_Click()
Dim i As Integer, str2 As String
Dim t As String
Dim i1 As Integer, str3 As String
Dim t1 As String
u = "6665686770697271747376757877"
For i = 1 To (Len(u)) Step 2
t = (Mid((u), i, 2))
str2 = (str2 & (Chr(t)))
Next
p = str2
For i1 = 1 To (Len(p)) Step 2
t1 = (Mid((p), i1, 2))
str3 = (str3 & (StrReverse(t1)))
Next
Text2 = str3
End Sub
这样可以了,但有没有简化一点的? 展开
Dim i As Integer, str2 As String
Dim t As String
u = "6665686770697271747376757877"
For i = 1 To (Len(u)) Step 2
t = (Mid((u), i, 2))
str2 = (str2 & (Chr(t)))
Next
Text2 = str2
End Sub
结果:
Text2="BADCFEHGJILKNM"
请问怎么样才可以编程以下的呢?
Text2="ABCDEFGHIJKLMN"
Private Sub Command1_Click()
Dim i As Integer, str2 As String
Dim t As String
Dim i1 As Integer, str3 As String
Dim t1 As String
u = "6665686770697271747376757877"
For i = 1 To (Len(u)) Step 2
t = (Mid((u), i, 2))
str2 = (str2 & (Chr(t)))
Next
p = str2
For i1 = 1 To (Len(p)) Step 2
t1 = (Mid((p), i1, 2))
str3 = (str3 & (StrReverse(t1)))
Next
Text2 = str3
End Sub
这样可以了,但有没有简化一点的? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询