一覧内に項目がある場合に True を返します。一覧には任意のタイプのオブジェクトを記述できます。同種である必要はありません。
member ( item As Any, _
list As List, _
Optional key As Name = :Identity, _
Optional test As Name = :Equal ) As Boolean
| 引数 | [タイプ] | 説明 |
|---|---|---|
| item | すべて | 一覧のメンバーシップを確認する項目です。この引数には NoValue を使用できます。 |
| list | [一覧] | 項目の一覧です。 |
| key | Name | 任意指定。一覧内の項目ごとに呼び出す関数の名前です。既定は:Identity です。 |
| テスト | Name | 任意指定。一覧内の項目のキー結果に適用するテスト関数の名前です。既定は:Equal です。 |
Intent >member(3, {7, 4, 3, 9, 0})
--> True
Intent >member(3, {7, 4, 9, 0})
--> False
Intent >member(3, {7, 4, 9, 0}, test := :sameType?)
--> True
Function sameType?(I As Any, j As Any) As Boolean
sameType? = (typeName(i) = typeName(j))
End Function
Intent >member(3, {a, b, c, d}, test := :sameType?)
--> False
この例でも、前の例で示したカスタム関数を使用します。 Intent >member(2, {"a", "bcd", "ef", "ghi"}, key := :length)
--> True
一覧のメンバの 1 つ、"ef" の長さが 2 のため True が返されています。