---
title: "isEqual(to:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsattributedstring/isequal(to:)"
---

# isEqual(to:)

Returns a Boolean value that indicates whether the attributed string is equal to the specified string.

## Declaration

```swift
func isEqual(to other: NSAttributedString) -> Bool
```

## Parameters

- `other`: The attributed string with which to compare the receiver.

## Return Value

Return Value true if the text and attributes in the current string and otherString are the same, otherwise false.

## Discussion

Discussion This method performs a character-by-character comparison of the string and its attributes. The character and its attributes must be the same in both strings for the method to return true. In attributed strings with many attributes, such a comparison is unlikely to yield an exact match true.
