Instance Method


Copies characters from a given range in the receiver into a given buffer.


func getCharacters(_ buffer: UnsafeMutablePointer<unichar>, range: NSRange)



Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the range aRange (aRange.length*sizeof(unichar)).


The range of characters to retrieve. The range must not exceed the bounds of the receiver.


This method does not add a NULL character.

The abstract implementation of this method uses character(at:) repeatedly, correctly extracting the characters, though very inefficiently. Subclasses should override it to provide a fast implementation.

You should always use the rangeOfComposedCharacterSequence(at:) or rangeOfComposedCharacterSequences(for:) method to determine character boundaries, so that any surrogate pairs or character clusters are handled correctly.