<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableAttributedString/deleteCharacters(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableAttributedString(im)deleteCharactersInRange:"
  },
  "title" : "deleteCharacters(in:)"
}
-->

# deleteCharacters(in:)

Deletes the characters in the given range along with their associated attributes.

```
func deleteCharacters(in range: NSRange)
```

## Parameters

`range`

A range specifying the characters to delete.

## Discussion

Raises an [`rangeException`](/documentation/Foundation/NSExceptionName/rangeException) if any part of `range` lies beyond the end of the receiver’s characters.

## See Also

[`replaceCharacters(in:with:)`](/documentation/Foundation/NSMutableAttributedString/replaceCharacters(in:with:)-1uaw7)

Replaces the characters and attributes in a given range with the characters and attributes of the given attributed string.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)