用空格或Tab分割字符串,但忽略双引号内的内容
可以自定义函数,也可以用正则表达式

解决方案 »

  1.   

    这个你要捕捉  空格或者 table键吧,然后改写某人程式WndProc 重载
      

  2.   

    已解决,公布代码:
    Private Function SplitStr(LineStr As String) As String()
        Dim list As New List(Of String)
                Dim curStr As String = String.Empty
                Dim flag As Boolean = False
                For i As Integer = 0 To LineStr.Length - 1
                    Dim c As Char = LineStr(i)
                    If c = Chr(34) Then
                        If flag Then
                            curStr += c
                            flag = False
                        Else
                            If LineStr.IndexOf("""", i + 1) <> -1 Then
                                curStr += c
                                flag = True
                            Else
                                curStr += c
                            End If
                        End If
                        If i = LineStr.Length - 1 Then
                            list.Add(curStr)
                            curStr = String.Empty
                        End If
                    Else
                        If c = " " Or c = Chr(9) Or i = LineStr.Length - 1 Then
                            If flag Then
                                curStr += c
                            Else
                                If i > 0 Then
                                    If LineStr(i - 1) <> " " And LineStr(i - 1) <> Chr(9) Then
                                        If c <> " " And c <> Chr(9) Then
                                            curStr += c
                                        End If
                                        list.Add(curStr)
                                        curStr = String.Empty
                                    End If
                                End If
                            End If
                        Else
                            curStr += c
                        End If
                    End If
                Next
                Dim rStr(list.Count - 1) As String
                For i As Integer = 0 To list.Count - 1
                    rStr(i) = list(i)
                Next
                Return rStr
    End Function