Instance Method

hasSuffix(_:)

Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.

Declaration

func hasSuffix(_ str: String) -> Bool

Parameters

aString

A string.

Return Value

true if aString matches the ending characters of the receiver, otherwise false. Returns false if aString is empty.

Discussion

This method is a convenience for comparing strings using the NSAnchoredSearch and NSBackwardsSearch options. See String Programming Guide for more information.

See Also

Related Symbols

func hasPrefix(String)

Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.