title: How could I rewrite this to remove the gotos without loss of speed or readability?
body: <p>I wrote this. Yes, I know it's VB6. Yes, it is production code, and, yeah, I know it uses gotos. I am a lazy, evil beast ... </p>
  
  <p>So show me (and the rest of us) how it <i>should</i> be written</p>
  
  <pre><code>Public Function SplitString(ByVal sText As Variant) As Variant
      Dim nHere As Long
      Dim cHere As String * 1
      Dim aRes As Variant
      Dim nRes As Long
      Dim bInquote As Boolean
      Dim sString As String
      ReDim aRes(0)
      nHere = 1
      nRes = 0
      Do
      If nHere &gt; Len(sText) Then Exit Do
      cHere = Mid$(sText, nHere, 1)
      If cHere = Chr$(32) Then
          If bInquote Then
          sString = sString &amp; cHere
          GoTo nextChar
          End If
          If sString &lt;&gt; vbNullString Then
          aRes(nRes) = sString
          sString = vbNullString
          nRes = nRes + 1
          ReDim Preserve aRes(nRes)
          End If
          GoTo nextChar
      ElseIf cHere = Chr$(34) Then
          bInquote = Not bInquote
          GoTo nextChar
      Else
          sString = sString &amp; cHere
      End If
  nextChar:
      nHere = nHere + 1
      Loop
      If sString &lt;&gt; vbNullString Then
      aRes(nRes) = sString
      End If
      SplitString = aRes
  End Function
  </code></pre>
  
  <p>By the way, it splits a string into an array. The elements in the string may be quoted.</p>