由于.net自带的分割字符串方法"String.Split"在使用多字符作为分割符时,有些问题,所以重写了一个方法,来应对这种情况.
Function Split(source As String, SplitStr As String) As String()
Dim arr As New ArrayList
Dim SpStrLen As Integer = SplitStr.Length
If SpStrLen <= 0 Then
Return Nothing
End If
While source <> String.Empty
Dim index As Integer = source.IndexOf(SplitStr)
If index >= 0 Then
arr.Add(source.Substring(0, index))
source = source.Remove(0, index + SpStrLen)
Else If source.Length > 0 Then
arr.Add(source)
Exit While
End If
End While
Return arr.ToArray(GetType(String))
End Function