<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/String/RangeReplaceableCollection-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "RangeReplaceableCollection Implementations"
}
-->

# RangeReplaceableCollection Implementations

## Topics

### Operators

[`static func + <Other>(Other, Self) -> Self`](/documentation/Swift/String/+(_:_:)-6h59y)

Creates a new collection by concatenating the elements of a sequence and a
collection.

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/String/+(_:_:)-9fm57)

Creates a new collection by concatenating the elements of two collections.

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/String/+(_:_:)-n329)

Creates a new collection by concatenating the elements of a collection and
a sequence.

[`static func += <Other>(inout Self, Other)`](/documentation/Swift/String/+=(_:_:)-676gx)

Appends the elements of a sequence to a range-replaceable collection.

### Initializers

[`init<S>(S)`](/documentation/Swift/String/init(_:)-1ip93)

Creates a new instance of a collection containing the elements of a
sequence.

[`init<S>(S)`](/documentation/Swift/String/init(_:)-8og6g)

Creates a new string containing the characters in the given sequence.

[`init(repeating: Character, count: Int)`](/documentation/Swift/String/init(repeating:count:)-11bpi)

Creates a string representing the given character repeated the specified
number of times.

[`init(repeating: Self.Element, count: Int)`](/documentation/Swift/String/init(repeating:count:)-5y5em)

Creates a new collection containing the specified number of a single,
repeated value.

### Instance Methods

[`func append(Self.Element)`](/documentation/Swift/String/append(_:)-1re5n)

Adds an element to the end of the collection.

[`func append(Character)`](/documentation/Swift/String/append(_:)-4xi3j)

Appends the given character to the string.

[`func append<S>(contentsOf: S)`](/documentation/Swift/String/append(contentsOf:)-7est5)

Appends the characters in the given sequence to the string.

[`func append<S>(contentsOf: S)`](/documentation/Swift/String/append(contentsOf:)-9foms)

Adds the elements of a sequence or collection to the end of this
collection.

[`func applying(CollectionDifference<Self.Element>) -> Self?`](/documentation/Swift/String/applying(_:))

Applies the given difference to this collection.

[`func filter<E>((Self.Element) throws(E) -> Bool) throws(E) -> Self`](/documentation/Swift/String/filter(_:)-66nw7)

Returns a new collection of the same type containing, in order, the
elements of the original collection that satisfy the given predicate.

[`func insert(Character, at: String.Index)`](/documentation/Swift/String/insert(_:at:))

Inserts a new character at the specified position.

[`func insert(Self.Element, at: Self.Index)`](/documentation/Swift/String/insert(_:at:)-88yqh)

Inserts a new element into the collection at the specified position.

[`func insert<S>(contentsOf: S, at: String.Index)`](/documentation/Swift/String/insert(contentsOf:at:))

Inserts a collection of characters at the specified position.

[`func insert<C>(contentsOf: C, at: Self.Index)`](/documentation/Swift/String/insert(contentsOf:at:)-rdu9)

Inserts the elements of a sequence into the collection at the specified
position.

[`func popLast() -> Self.Element?`](/documentation/Swift/String/popLast())

Removes and returns the last element of the collection.

[`func remove(at: String.Index) -> Character`](/documentation/Swift/String/remove(at:))

Removes and returns the character at the specified position.

[`func remove(at: Self.Index) -> Self.Element`](/documentation/Swift/String/remove(at:)-5g0wm)

Removes and returns the element at the specified position.

[`func removeAll(keepingCapacity: Bool)`](/documentation/Swift/String/removeAll(keepingCapacity:))

Replaces this string with the empty string.

[`func removeAll(keepingCapacity: Bool)`](/documentation/Swift/String/removeAll(keepingCapacity:)-6xw7h)

Removes all elements from the collection.

[`func removeAll(where: (Self.Element) throws -> Bool) rethrows`](/documentation/Swift/String/removeAll(where:))

Removes all the elements that satisfy the given predicate.

[`func removeFirst() -> Self.Element`](/documentation/Swift/String/removeFirst())

Removes and returns the first element of the collection.

[`func removeFirst(Int)`](/documentation/Swift/String/removeFirst(_:))

Removes the specified number of elements from the beginning of the
collection.

[`func removeLast() -> Self.Element`](/documentation/Swift/String/removeLast())

Removes and returns the last element of the collection.

[`func removeLast(Int)`](/documentation/Swift/String/removeLast(_:))

Removes the specified number of elements from the end of the
collection.

[`func removeSubrange(Range<String.Index>)`](/documentation/Swift/String/removeSubrange(_:))

Removes the characters in the given range.

[`func removeSubrange(Range<Self.Index>)`](/documentation/Swift/String/removeSubrange(_:)-8maxn)

Removes the elements in the specified subrange from the collection.

[`func removeSubrange<R>(R)`](/documentation/Swift/String/removeSubrange(_:)-9twng)

Removes the elements in the specified subrange from the collection.

[`func removeSubranges(RangeSet<Self.Index>)`](/documentation/Swift/String/removeSubranges(_:))

Removes the elements at the given indices.

[`func replaceSubrange<C>(Range<String.Index>, with: C)`](/documentation/Swift/String/replaceSubrange(_:with:))

Replaces the text within the specified bounds with the given characters.

[`func replaceSubrange<C>(Range<Self.Index>, with: C)`](/documentation/Swift/String/replaceSubrange(_:with:)-3hkd6)

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C, R>(R, with: C)`](/documentation/Swift/String/replaceSubrange(_:with:)-72947)

Replaces the specified subrange of elements with the given collection.

[`func reserveCapacity(Int)`](/documentation/Swift/String/reserveCapacity(_:))

Reserves enough space in the string’s underlying storage to store the
specified number of ASCII characters.

[`func reserveCapacity(Int)`](/documentation/Swift/String/reserveCapacity(_:)-8lw57)

Prepares the collection to store the specified number of elements, when
doing so is appropriate for the underlying type.

---

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)