Contents

contains(_:)

Returns a Boolean value indicating whether the string contains a given string by performing a case-sensitive, locale-unaware search.

Declaration

func contains(_ str: String) -> Bool

Parameters

  • str:

    The string to search for. This value must not be nil.

Return Value

true if the receiver contains str, otherwise false.

Discussion

Calling this method is equivalent to calling range(of:options:) with no options.

See Also

Finding Characters and Substrings