Foxtable(狐表)用户栏目专家坐堂 → 输出集合中某几个元素


  共有5085人关注过本帖树形打印复制链接

主题:输出集合中某几个元素

帅哥哟,离线,有人找我吗?
lsy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2013/5/5 11:10:00 [显示全部帖子]

这是表中日期值:

Dim s As String = "05-01,06-01,10-01"
Dim str As String = ""
Dim dt As String = ""
For Each r As Row In CurrentTable.Rows
    dt = Format(r("日期").Month,"00") & "-" & Format(r("日期").Day,"00")
    If s.Contains(dt) Then
        str = str & " 第 " & r.Index & " 行: " & CStr(r("日期"))
    End If
Next
MessageBox.Show(str)

 

如果是数组中的值:(这里数组比集合简单)

Dim s() As String = {"2013-02-03","2013-05-01","2014-06-01","2013-07-08","2013-10-01","2014-06-01"}
Dim str As String = ""
For i As Integer = 0 To s.Length - 1
    If right(s(i),5) = "05-01" OrElse right(s(i),5) = "06-01"  OrElse right(s(i),5) = "10-01" Then
        str = str & " " & s(i)
    End If
Next
MessageBox.Show(str)

 

[此贴子已经被作者于2013-5-5 11:27:45编辑过]

 回到顶部