Contents

init(bytes:length:encoding:)

Returns an initialized NSString object containing a given number of bytes from a given buffer of bytes interpreted in a given encoding.

Declaration

convenience init?(bytes: UnsafeRawPointer, length len: Int, encoding: UInt)

Parameters

  • bytes:

    A buffer of bytes interpreted in the encoding specified by encoding.

  • len:

    The number of bytes to use from bytes.

  • encoding:

    The character encoding applied to bytes. For possible values, see Nsstringencoding.

Return Value

An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The returned object may be different from the original receiver. The return byte strings are allowed to be unterminated. If the length of the byte string is greater than the specified length a nil value is returned.

See Also

Creating and Initializing Strings