---
title: invert()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/characterset/invert()
---

# invert()

Invert the contents of the CharacterSet.

## Declaration

```swift
mutating func invert()
```

## See Also

### Inverting a Character Set

- [inverted](foundation/characterset/inverted.md)
