'数组快速排序 (递归算法) 顺序，从小到大
Sub QuickSortStr(Arr() as String, ByVal LB as Long, ByVal UB as Long)
   Dim as Long M1 , M2 , Tmp
   Dim as String  Piv  '<- 调整类型在这里，当切换到不同于Long的东西
   
   If UB - LB = 1 Then
      M1 = LB : Goto there4
   Else
      Tmp = (LB + UB) \ 2
      If Arr(Tmp) = Arr(LB) Then
         
         M2 = UB
         Tmp = LB
         Do
            Tmp = Tmp + 1
            If Tmp > M2 Then Goto there3
         Loop Until Arr(Tmp) <> Arr(LB)
      End If
   End If
   
   M1 = LB
   M2 = UB
   Piv = Arr(Tmp) '创建数据透视元素
   
   Do
      Do While(Arr(M1) < Piv)
         M1 = M1 + 1
      Loop
      Do While(Arr(M2) > Piv)
         M2 = M2 - 1
      Loop
      
      If M1 <= M2 Then
         'st = Arr(M1): Arr(M1) = Arr(M2): Arr(M2) = st 'swap
         Swap Arr(M1), Arr(M2)
         M1 = M1 + 1
         M2 = M2 - 1
      End If
   Loop Until M1 > M2
   
   If LB < M2 Then QuickSortStr Arr(), LB, M2
   If M1 < UB Then QuickSortStr Arr(), M1, UB
   Exit Sub
there3 : 
   For M1 = LB + 1 To UB - 1
      If Arr(M1) <> Arr(LB) Then Exit For
   Next M1
   
   If M1 < UB - 1 Then
      QuickSortStr Arr(), M1, UB
   ElseIf M1 < UB Then
there4 : 
      If Arr(M1) > Arr(UB) Then Swap Arr(M1), Arr(UB) '  Tmp = Arr(M1): Arr(M1) = Arr(UB): Arr(UB) = Tmp
   Else
      If Arr(UB) < Arr(LB) Then Swap Arr(LB), Arr(UB) ' Tmp = Arr(LB): Arr(LB) = Arr(UB): Arr(UB) = Tmp
   End If
End Sub