---
title: "components(separatedBy:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/stringprotocol/components(separatedby:)-4j26n"
---

# components(separatedBy:)

Returns an array containing substrings from the string that have been divided by characters in the given set.

## Declaration

```swift
func components(separatedBy separator: CharacterSet) -> [String]
```
