---
title: "deleteCharacters(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutablestring/deletecharacters(in:)"
---

# deleteCharacters(in:)

Removes from the receiver the characters in a given range.

## Declaration

```swift
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

Discussion This method treats the length of the string as a valid range value that returns an empty string.

## See Also

### Modifying a String

- [append(_:)](foundation/nsmutablestring/append(_:).md)
- [applyTransform(_:reverse:range:updatedRange:)](foundation/nsmutablestring/applytransform(_:reverse:range:updatedrange:).md)
- [insert(_:at:)](foundation/nsmutablestring/insert(_:at:).md)
- [replaceCharacters(in:with:)](foundation/nsmutablestring/replacecharacters(in:with:).md)
- [replaceOccurrences(of:with:options:range:)](foundation/nsmutablestring/replaceoccurrences(of:with:options:range:).md)
- [setString(_:)](foundation/nsmutablestring/setstring(_:).md)
