字符串按照长度排序

VBA:

好像不能识别一些在excel里有特殊意义的字符。

    Sub Button1_Click()            Dim max As Integer        max = 1        Dim lengths(200) As Integer        Dim tmp As String                For i = 1 To 200           max = i           tmp = Cells(i, 1)           If tmp = "" Then               Exit For           End If           For j = i + 1 To 200               If Cells(j, 1) = "" Then                   Exit For               End If               If Len(Cells(max, 1)) < Len(Cells(j, 1)) Then                   max = j               End If           Next           If i <> max Then               Cells(i, 1) = Cells(max, 1)                             Cells(max, 1) = tmp           End If        Cells(i, 2) = Len(Cells(max, 1))        Next    End Sub
//最简单的是通过shell
awk '{ print length(), $0 | "sort -n" }' fileName
//通过sql, 将数据倒入Tmp表格
select len(fileName), fileNamefrom Test1order by len(fileName)

只是需要垮上后座的勇气和一颗想走即走的心,

字符串按照长度排序

相关文章:

你感兴趣的文章:

标签云: