---
title: "init(charactersIn:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nscharacterset/init(charactersin:)"
---

# init(charactersIn:)

Returns a character set containing the characters in a given string.

## Declaration

```swift
init(charactersIn aString: String)
```

## Parameters

- `aString`: A string containing characters for the new character set.

## Return Value

Return Value A character set containing the characters in aString. Returns an empty character set if aString is empty.

## See Also

### Creating a Custom Character Set

- [init(coder:)](foundation/nscharacterset/init(coder:).md)
- [init(range:)](foundation/nscharacterset/init(range:).md)
- [NSOpenStepUnicodeReservedBase](foundation/1560803-nsopenstepunicodereservedbase.md)
