---
title: "replaceSubrange(_:with:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/substring/replacesubrange(_:with:)-mfwu"
---

# replaceSubrange(_:with:)

## Declaration

```swift
mutating func replaceSubrange(_ subrange: Range<Substring.Index>, with newElements: Substring)
```
