VB排序算法源码,支持倒序顺序字符排序数字排序

前端之家收集整理的这篇文章主要介绍了VB排序算法源码,支持倒序顺序字符排序数字排序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

VB排序算法源码,支持倒序顺序字符排序数字排序

Function 数字数组排序(Sz)
Dim KeepChecking As Boolean
Dim I As Long
Dim FirstValue
Dim SecondValue
Dim Ub As Long
Dim Ub2 As Long
KeepChecking = True
Ub = UBound(Sz)
Ub2 = Ub - 1
While KeepChecking
    KeepChecking = False
    For I = 0 To Ub2
        If Sz(I) > Sz(I + 1) Then
                FirstValue = Sz(I)
                SecondValue = Sz(I + 1)
                Sz(I) = SecondValue
                Sz(I + 1) = FirstValue
                KeepChecking = True
        End If
    Next
Wend
数字数组排序 = Sz
End Function

猜你在找的VB相关文章