---
title: "setString(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutablestring/setstring(_:)"
---

# setString(_:)

Replaces the characters of the receiver with those in a given string.

## Declaration

```swift
func setString(_ aString: String)
```

## Parameters

- `aString`: The string with which to replace the receiver’s content. aString must not be nil.

## See Also

### Modifying a String

- [append(_:)](foundation/nsmutablestring/append(_:).md)
- [applyTransform(_:reverse:range:updatedRange:)](foundation/nsmutablestring/applytransform(_:reverse:range:updatedrange:).md)
- [deleteCharacters(in:)](foundation/nsmutablestring/deletecharacters(in:).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)
