vb 文本转换
我想把text1里的内容转换下把每列的内容转换成行如text1里的内容为181840011067265160475732…………转换后就成为text21024816711...
我想把text1里的内容转换下
把每列的内容转换成行
如
text1里的内容为
181840
011067
265160
475732
…………
转换后就成为
text2
1024
8167
1155
8017
4663
0702
数据不止这么少有很多
其中还有可能出现字母 展开
把每列的内容转换成行
如
text1里的内容为
181840
011067
265160
475732
…………
转换后就成为
text2
1024
8167
1155
8017
4663
0702
数据不止这么少有很多
其中还有可能出现字母 展开
3个回答
展开全部
'text1中的数据每行必须等长
Private Sub Command1_Click()
Dim arr, brr() As String, i As Long, j As Long
arr = Split(Text1, vbNewLine)
ReDim brr(1 To Len(arr(0)))
For i = 0 To UBound(arr, 1)
For j = 1 To Len(arr(0))
brr(j) = brr(j) & Mid(arr(i), j, 1)
Next
Next
Text2 = Join(brr, vbNewLine)
End Sub
Private Sub Form_Load()
Dim arr
arr = Split("181840 011067 265160 475732")
Text1 = Join(arr, vbNewLine)
End Sub
Private Sub Command1_Click()
Dim arr, brr() As String, i As Long, j As Long
arr = Split(Text1, vbNewLine)
ReDim brr(1 To Len(arr(0)))
For i = 0 To UBound(arr, 1)
For j = 1 To Len(arr(0))
brr(j) = brr(j) & Mid(arr(i), j, 1)
Next
Next
Text2 = Join(brr, vbNewLine)
End Sub
Private Sub Form_Load()
Dim arr
arr = Split("181840 011067 265160 475732")
Text1 = Join(arr, vbNewLine)
End Sub
展开全部
思路:
假设Text1里有数据:H行,每行有L位。
1、Dim A(1 To H) as string,d(1 To L) As String
2、将H行数据读入到数组A,A(1)----A(H)
3、text2.text=""
For i = 1 To L
d(i) = ""
For j = 1 To H
d(i) = d(i) & Mid(A(j),i,1)
Next j
text2.text=text2.text & d(i) & vbCrLf
Next i
假设Text1里有数据:H行,每行有L位。
1、Dim A(1 To H) as string,d(1 To L) As String
2、将H行数据读入到数组A,A(1)----A(H)
3、text2.text=""
For i = 1 To L
d(i) = ""
For j = 1 To H
d(i) = d(i) & Mid(A(j),i,1)
Next j
text2.text=text2.text & d(i) & vbCrLf
Next i
追问
谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Text2 = ""
Dim a() As String
a = Split(Text1, vbCrLf)
For j = 1 To Len(a(i))
For i = 0 To UBound(a)
Text2 = Text2 & Mid(a(i), j, 1)
Next
Text2 = Text2 & vbCrLf
Next
End Sub
Text2 = ""
Dim a() As String
a = Split(Text1, vbCrLf)
For j = 1 To Len(a(i))
For i = 0 To UBound(a)
Text2 = Text2 & Mid(a(i), j, 1)
Next
Text2 = Text2 & vbCrLf
Next
End Sub
追问
谢谢 不过数量大了 文件会被卡死
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询