CFStringGetMaximumSizeForEncoding(_:_:)
Returns the maximum number of bytes a string of a specified length (in Unicode characters) will take up if encoded in a specified encoding.
Declaration
func CFStringGetMaximumSizeForEncoding(_ length: CFIndex, _ encoding: CFStringEncoding) -> CFIndexParameters
- length:
The number of Unicode characters to evaluate.
- encoding:
The string encoding for the number of characters specified by
length.
Return Value
The maximum number of bytes that could be needed to represent length number of Unicode characters with the string encoding encoding, or kCFNotFound if the number exceeds LONG_MAX.
Discussion
The number of bytes that the encoding actually ends up requiring when converting any particular string could be less than the returned value, but never more.
See Also
Working With Encodings
CFStringConvertEncodingToIANACharSetName(_:)CFStringConvertEncodingToNSStringEncoding(_:)CFStringConvertEncodingToWindowsCodepage(_:)CFStringConvertIANACharSetNameToEncoding(_:)CFStringConvertNSStringEncodingToEncoding(_:)CFStringConvertWindowsCodepageToEncoding(_:)CFStringGetFastestEncoding(_:)CFStringGetListOfAvailableEncodings()CFStringGetMostCompatibleMacStringEncoding(_:)CFStringGetNameOfEncoding(_:)CFStringGetSmallestEncoding(_:)CFStringGetSystemEncoding()CFStringIsEncodingAvailable(_:)