这要怎么实现
我想实现这样的一个目的,比如说定义字符串 SString = "ABC",想通过函数fun输出它每个元素的值,实参是字符串,那函数fun要用什么做形参呢? 函数
[解决办法]
这样就可以了:
Private Sub Command1_Click()
Dim x
x = fun("abcde")
MsgBox Join(x, vbCrLf)
End Sub
Function fun(ByVal sstring As String)
Dim v() As String, i As Long
ReDim v(1 To Len(sstring))
For i = 1 To Len(sstring)
v(i) = Mid(sstring, i, 1)
Next
fun = v
End Function