VBScript Filtre İşlevi
❮ Komple VBScript ReferansıFiltre işlevi, filtre ölçütlerine dayalı bir dize dizisinin alt kümesini içeren sıfır tabanlı bir dizi döndürür.
Not: value parametresinin hiçbir eşleşmesi bulunamazsa, Filter işlevi boş bir dizi döndürür.
Not: Giriş dizeleri parametresi Null ise veya tek boyutlu bir dizi DEĞİLSE, bir hata oluşur.
Sözdizimi
Filter(inputstrings,value[,include[,compare]])
Parameter | Description |
---|---|
inputstrings | Required. A one-dimensional array of strings to be searched |
value | Required. The string to search for |
include | Optional. A Boolean value that indicates whether to return the substrings that include or exclude value. True returns the subset of the array that contains value as a substring. False returns the subset of the array that does not contain value as a substring. Default is True. |
compare | Optional. Specifies the string comparison to use. Can have one of the following values:
|
Örnekler
örnek 1
Filtre: "S" içeren öğeler
<%
a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
b=Filter(a,"S")
for each x in b
response.write(x & "<br />")
next
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
Sunday
Saturday
Örnek 2
Filtre: "S" İÇERMEYEN öğeler (include=False):
<%
a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
b=Filter(a,"S",False)
for each x in b
response.write(x & "<br />")
next
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
Monday
Tuesday
Wednesday
Thursday
Friday
Örnek 3
Filtre: metinsel bir karşılaştırma ile "S" içeren öğeler (karşılaştırma=1):
<%
a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
b=Filter(a,"S",True,1)
for each x in b
response.write(x & "<br />")
next
%>
Yukarıdaki kodun çıktısı şöyle olacaktır:
Sunday
Tuesday
Wednesday
Thursday
Saturday
❮ Komple VBScript Referansı