<!--
{
  "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/NSMutableString/deleteCharacters(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableString(im)deleteCharactersInRange:"
  },
  "title" : "deleteCharacters(in:)"
}
-->

# deleteCharacters(in:)

Removes from the receiver the characters in a given range.

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

## Parameters

`range`

The range of characters to delete. `range` must not exceed the bounds of the receiver.
  
  > Important:
  > Raises an `NSRangeException` if any part of `range` lies beyond the end of the string.

## Discussion

This method treats the length of the string as a valid range value that returns an empty 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)