Instance Method インスタンスメソッド

contains(_:)

Returns a Boolean value that indicates whether a given element is a member of the option set. 与えられた要素がオプションセットのメンバであるかどうかを指し示すブール値を返します。

Declaration 宣言

func contains(_ member: AttributedString.FormattingOptions) -> Bool

Parameters パラメータ

member

The element to look for in the option set. オプションセットにおいて捜される要素。

Return Value 戻り値

true if the option set contains member; otherwise, false. true、もしオプションセットがmemberを含むならば;そうでなければfalse

Discussion 議論

This example uses the contains(_:) method to check whether next-day shipping is in the availableOptions instance. この例は、contains(_:)メソッドを使って翌日出荷がavailableOptionsインスタンスの中のあるかどうか確認します。


let availableOptions = ShippingOptions.express
if availableOptions.contains(.nextDay) {
    print("Next day shipping available")
}
// Prints "Next day shipping available"

See Also 参照

Performing Set Operations 集合演算を実行する