以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  获取最后一个-后最大数值  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90904)

--  作者:lshshlxsh
--  发布时间:2016/9/24 18:28:00
--  获取最后一个-后最大数值
aa-2016-1000
bb-2013-1
cc-2014-2
cc-2014-3
bb-2013-10
cc-2014-210
cc-2014-301
  请问一下 如何获取某列 第二个- 后面最大数值?
[此贴子已经被作者于2016/9/24 18:29:17编辑过]

--  作者:狐狸爸爸
--  发布时间:2016/9/24 18:36:00
--  

Dim ss() As String = {"aa-2016-1000","bb-2013-001","cc-204-003"}
Dim v As Integer
Dim max As Integer
For Each s As String In ss
    Dim vs As String = s.SubString(s.LastIndexOf("-")+1)
    If Integer.TryParse(vs,v)
        If  v > max  Then
            max = v
        End If
    End If
Next
Return max

 

 

 

http://www.foxtable.com/webhelp/scr/1338.htm


http://www.foxtable.com/webhelp/scr/0324.htm

 


--  作者:lshshlxsh
--  发布时间:2016/9/24 18:38:00
--  
谢谢狐狸爸爸