回覆列表
-
1 # 落魄人生
-
2 # 初時模樣一夢味少
你那中間是空格還是tab?
如果是不確定長度的空格,
dountilinstr(str2,"")=0"引號裡是兩個空格
str2=replace(str2,"","")"把兩個空格替換成一個空格
loop
str1=split(str2,"")"一個空格
你那中間是空格還是tab?
如果是不確定長度的空格,
dountilinstr(str2,"")=0"引號裡是兩個空格
str2=replace(str2,"","")"把兩個空格替換成一個空格
loop
str1=split(str2,"")"一個空格
1. 函式解釋: 將一個字串按照某個子字串分割成字元陣列。Function Split(Expression As String, [Delimiter], [Limit As Long = -1], [Compare As VbCompareMethod = vbBinaryCompare]) Member of VBA.Strings Split a string into an array2. 例子Private Sub Command1_Click()Dim x As Stringx = "a b c"Dim yy = Split(x, " ")For i = 0 To UBound(y) Debug.Print y(i)NextEnd Sub