VB分割文本,参考实例如枯大下:
Private Sub Command1_Click()
Dim arr
斗败启arr = Split(Text1, "")
MsgBox Join(arr, vbNewLine)
End Sub
Private Sub Form_Load()
Text1 = "a1a2a3a4an"空如
End Sub
你这里应该不包括前后面的中文冒号吧。。。分割条件就是配段源split函数后面的那个参数,你对燃态照你那边的改一下就可以了,我这个是用培态你贴的这段试用的,运行OK。。Private
Sub
Command1_Click()
Dim
a
As
String,
b()
As
String,
n
As
Integer,
s
As
String
Open
App.Path
&
"\aa.txt"
For
Input
As
#1
Do
While
Not
EOF(1)
Line
Input
#1,
s
a
=
a
&
s
&
vbCrLf
Loop
Close
#1
b
=
Split(a,
"条:
"
&
vbCrLf)
For
n
=
1
To
UBound(b)
Open
App.Path
&
"\"
&
Format(n,
"0000")
&
".txt"
For
Output
As
#1
s
=
Left(b(n),
IIf(InStr(b(n),
"第")
>
1,
InStr(b(n),
"第")
-
1,
Len(b(n))))
#1,
s
Close
#1
Next
MsgBox
"OK"
End
Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)