Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共10 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:老师给指点一下,排序错在哪里了

1楼
xxfoxtable 发表于:2024/9/9 21:36:00
Dim Multi As String = "A8,A6,A7,A5"
Dim Values() As String
Values = Multi.split(",")
Dim ls As String = ""
Dim j As Integer
For i As Integer = 0 To Values.Length - 1
    For j = 1 To Values.Length - 1
        If Values(i) > Values(j) Then
            ls = Values(i)
            Values(i) = Values(j)
            Values(j) = Ls
        End If
    Next 
Next
Dim zf As String = ""
For Index As Integer = 0 To Values.Length - 1
    If Values(index).Trim <> "" Then
        If zf = "" Then
            zf = Values(index)
        Else
            zf = zf & "," & Values(index)
        End If
    End If
Next
MessageBox.Show(zf)
2楼
有点蓝 发表于:2024/9/9 22:16:00
Dim Multi As String = "A8,A6,A7,A5"
Dim lst As New List(Of String)
lst.AddRange(Multi.Split(","))
lst.Sort
Dim zf As String = String.Join(",", lst.ToArray)
MessageBox.Show(zf)
3楼
xxfoxtable 发表于:2024/9/9 23:01:00
Dim Multi As String = ""
Dim lst As New List(Of String)
lst.AddRange(Multi.Split(","))
MessageBox.Show(lst.Count)
没有元素的情况下lst.count=1,是什么情况呢?
4楼
有点蓝 发表于:2024/9/9 23:03:00
空字符串也是有效的值
5楼
xxfoxtable 发表于:2024/9/9 23:05:00
那怎么判断,里面有几个元素呢?
6楼
有点蓝 发表于:2024/9/10 8:32:00
判断有没有内容再做后续处理

Dim Multi As String = ""
if Multi > ""
Dim lst As New List(Of String)
……
7楼
xxfoxtable 发表于:2024/9/19 12:50:00
老师这个降序怎么写?
Dim Multi As String = "A8,A6,A7,A5"
Dim lst As New List(Of String)
lst.AddRange(Multi.Split(","))
lst.Sort
Dim zf As String = String.Join(",", lst.ToArray)
MessageBox.Show(zf)
8楼
有点蓝 发表于:2024/9/19 13:33:00
http://www.foxtable.com/webhelp/topics/0217.htm
9楼
cd_tdh 发表于:2024/9/19 14:06:00
Dim Multi As String = "A8,A6,A7,A5"
Dim lst As New List(Of String)
lst.AddRange(Multi.Split(","))
lst.Sort() 
lst.Reverse()
Dim zf As String = String.Join(",", lst.ToArray)
MessageBox.Show(zf)
10楼
y2287958 发表于:2024/9/19 15:26:00
Output.Show(String.Join(",", "A8,A6,A7,A5".Split(",").OrderByDescending(Function(元素) 元素)))

共10 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .04688 s, 2 queries.