domain .tw idv.tw .com.tw
你正在閱覽 :: 繁體中文:: 學習 ASP SQL VB HTML code

學習 .ASP SQL HTML XML CSS JAVA Perl code study
English Chinese_Traditional Chinese_Simplified

你正在閱覽 :: 繁體中文 Chinese_Traditional

學習.主題:
首頁
ASP
CSS
Ecommerce
HTML
InternetProtocol
JAVA
Microsoft
Robots
SearchEngine
SQL
SQLserver
VBscript
. Array
»Filter
»Split
»UBound
. Functions
. Prevent_hacker
XML

SiteMap

3w....學習.教學 > VBSCRIPT > array » filter

3w learning

array >
filter

Title:

Filter(Input Strings,value[,include[,compare]])


過濾出所含某特定元素並組成陣列
Description:

Filter(Input Strings,value[,include[,compare]]) Input Strings : The main strings Value : to be searched value Include : [ True ::( Default ) the array contains value ] [ False :: the array that does not contain value ] compare :optional Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values comparison same as Split vbBinaryCompare : 0 : Perform a binary comparison vbTextCompare : 1 : Perform a textual comparison


Example Code:

a memo report weather and date in one data cell or a text file weather= "1/1/2006w:sun,1/2/2006w:rain,1/3/2006w:storm,1/4/2006w:...." <% dim weather,dayArray,queryDay queryDay="8/6/2006" weather=request("weather") dayArray=Split(weather,",") ' if the end of weather string is ( , ) then UBound(dayArray)-1 for I=0 to UBound(dayArray)-1 ' -1 is for ( , ) ending ' way 1 ---- filter to find queryDay TrueDayArray=Filter(dayArray,queryDay) if TrueDayArray(0)<>empty then document.write(replace(TrueDayArray(0),"w:"," weather is ")) end if ' way 2 ---- instr to find queryDay if instr(dayArray(I),queryDay)>0 then response.write replace(dayArray(I),"w:"," weather is ")&"<br>" response.write replace(dayArray(I),queryDay&"w:","") end if next %>


Filter 常配合 Split, UBound, Array, instr, 
replace 更加方便呼叫出所要的資料
Example Result:

Example : 8/6/2006 weather is sun sun



..
...
...

[ 11/20/2008 ]

www learning school add more scripts and tips memo
You are at >>3WT.EZER.COM >> 3WT.EZER.COM/VBSCRIPT/ARRAY/FILTER.ASP>>VBSCRIPT
Helpful link:: SEO web tools :: Live PR | SERP checker
back to top Ezer code adding :: Questions ;email