CFStringGetCharacters(_:_:_:)
Copies a range of the Unicode characters from a string to a user-provided buffer.
Declaration
func CFStringGetCharacters(_ theString: CFString!, _ range: CFRange, _ buffer: UnsafeMutablePointer<UniChar>!)Parameters
- theString:
The string from which the characters are to be obtained.
- range:
The range of characters to copy. The specified range must not exceed the length of the string.
- buffer:
The
UniCharbuffer of lengthrange.lengththat you have allocated on the stack or heap. On return, the buffer contains the requested Unicode characters.
Discussion
Use this function to obtain some or all of the Unicode characters represented by a CFString object. If this operation involves a large number of characters, the function call can be expensive in terms of memory. Instead you might want to consider using the in-line buffer functions CFStringInitInlineBuffer(_:_:_:) and CFStringGetCharacterFromInlineBuffer(_:_:) to extract the characters incrementally.
See Also
Accessing Characters
CFStringCreateExternalRepresentation(_:_:_:_:)CFStringGetBytes(_:_:_:_:_:_:_:_:)CFStringGetCharacterAtIndex(_:_:)CFStringGetCharactersPtr(_:)CFStringGetCharacterFromInlineBuffer(_:_:)CFStringGetCString(_:_:_:_:)CFStringGetCStringPtr(_:_:)CFStringGetLength(_:)CFStringGetPascalString(_:_:_:_:)CFStringGetPascalStringPtr(_:_:)CFStringGetRangeOfComposedCharactersAtIndex(_:_:)CFStringInitInlineBuffer(_:_:_:)