VB如何实现字符串奇偶位置的互换
从文本文档中提取的一组数据,比如FF1FFF1FFF1FF1FF如何将其转换为1FFF1FFF1FFFFFF1.我的程序DimaAsString,bAsString,cA...
从文本文档中提取的一组数据,
比如FF 1F FF 1F FF 1F F1 FF如何将其转换为
1F FF 1F FF 1F FF FF F1.
我的程序
Dim a As String, b As String, c As String, d As String
Open "f:\1.txt" For Input As #1
For i = 0 To 8
' For j = 0 To 1
Do While Not EOF(1)
Line Input #1, a
a = a & S
' Debug.Print a
Loop
'Next j
Next i
Debug.Print
Close #1
b = Split(a, " ")
For i = 0 To Len(b) Step 2
c = c + b(i + 1) + " " + b(i) + " "
Next i
Debug.Print c
错误提示为Len(b)缺少数组
Dim a As String, c As String
Open "f:\1.txt" For Input As #1
For i = 0 To 8
Do While Not EOF(1)
Line Input #1, a
a = a & S
' Debug.Print a
Loop
Next i
Debug.Print
Close #1
b = Split(a, " ")
For i = 0 To Len(b) Step 2
c = c + b(i + 1) + " " + b(i) + " "
Next i
Debug.Print c
改正后提示类型不匹配 展开
比如FF 1F FF 1F FF 1F F1 FF如何将其转换为
1F FF 1F FF 1F FF FF F1.
我的程序
Dim a As String, b As String, c As String, d As String
Open "f:\1.txt" For Input As #1
For i = 0 To 8
' For j = 0 To 1
Do While Not EOF(1)
Line Input #1, a
a = a & S
' Debug.Print a
Loop
'Next j
Next i
Debug.Print
Close #1
b = Split(a, " ")
For i = 0 To Len(b) Step 2
c = c + b(i + 1) + " " + b(i) + " "
Next i
Debug.Print c
错误提示为Len(b)缺少数组
Dim a As String, c As String
Open "f:\1.txt" For Input As #1
For i = 0 To 8
Do While Not EOF(1)
Line Input #1, a
a = a & S
' Debug.Print a
Loop
Next i
Debug.Print
Close #1
b = Split(a, " ")
For i = 0 To Len(b) Step 2
c = c + b(i + 1) + " " + b(i) + " "
Next i
Debug.Print c
改正后提示类型不匹配 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询