---
title: "CFCharacterSetCreateWithCharactersInString(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfcharactersetcreatewithcharactersinstring(_:_:)"
---

# CFCharacterSetCreateWithCharactersInString(_:_:)

Creates a new character set with the values in the given string.

## Declaration

```swift
func CFCharacterSetCreateWithCharactersInString(_ alloc: CFAllocator!, _ theString: CFString!) -> CFCharacterSet!
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `theString`: A string containing the characters for the new set.

## Return Value

Return Value A new character set containing the characters from theString. Ownership follows the The Create Rule.

## See Also

### Creating Character Sets

- [CFCharacterSetCreateCopy(_:_:)](corefoundation/cfcharactersetcreatecopy(_:_:).md)
- [CFCharacterSetCreateInvertedSet(_:_:)](corefoundation/cfcharactersetcreateinvertedset(_:_:).md)
- [CFCharacterSetCreateWithCharactersInRange(_:_:)](corefoundation/cfcharactersetcreatewithcharactersinrange(_:_:).md)
- [CFCharacterSetCreateWithBitmapRepresentation(_:_:)](corefoundation/cfcharactersetcreatewithbitmaprepresentation(_:_:).md)
