以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  输出集合中某几个元素  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=32612)

--  作者:我爱狐表011
--  发布时间:2013/5/5 10:17:00
--  输出集合中某几个元素

Dim t As Date

Dim Value() As NewList(日期A—日期B),如(2013年5月5日—2014年11月1日)

判断Value()中是否包括5月1日,6月1日,10月1日

如果包括的话,则输出:2013年6月1日,2013年10月1日,2014年5月1日,2014,6月1日,2014,10月1日

 

不知道代码怎么写??????

 


--  作者:lsy
--  发布时间: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编辑过]