# Re: 字串分解的小问题.....

Posted by Honey on November 14, 1998 at 00:15:48:

In Reply to: Re: 字串分解的小问题..... posted by YS on November 13, 1998 at 21:05:41:

提供以下程式给你参考
在Form1上 放个Command1 Text1
在Text1中输入字串

Private Sub Command1_Click()
Dim pString() As String
Dim i As Long, k As Long, j As Long
k = Len(Text1.Text)
j = 1

ReDim pString(j)
For i = 1 To k
If Not Mid(Text1.Text, i, 1) = " " Then
ReDim Preserve pString(j)
pString(j) = pString(j) + Mid(Text1.Text, i, 1)
Else
If pString(j) = " " Or pString(j) = "" Then
Else
j = j + 1
ReDim Preserve pString(j)
End If
End If
Next

For i = 1 To j
Form1.Print pString(i)
Next
End Sub

我是用一个字元一个字元去寻找
你可以改用instr这函数去做
也许会比较快
我只是提供点方法 其他得靠你自己想喔

Follow Ups: