Instance Method

maximum​Length​Of​Bytes(using:​)

Returns the maximum number of bytes needed to store the receiver in a given encoding.

Declaration

func maximumLengthOfBytes(using enc: UInt) -> Int

Parameters

enc

The encoding for which to determine the receiver's length.

Return Value

The maximum number of bytes needed to store the receiver in encoding in a non-external representation. The length does not include space for a terminating NULL character. Returns 0 if the amount of memory required for storing the results of the encoding conversion would exceed NSInteger​Max.

Discussion

The result is an estimate and is returned in O(1) time; the estimate may be considerably greater than the actual length needed.

See Also

Related Symbols

var length:​ Int

The number of UTF-16 code units in the receiver.

func length​Of​Bytes(using:​ UInt)

Returns the number of bytes required to store the receiver in a given encoding.