Contents

init(bytes:encoding:)

Creates a new string equivalent to the given bytes interpreted in the specified encoding. Note: This API does not interpret embedded nulls as termination of the string. Use String?(validatingCString:) instead for null-terminated C strings.

Declaration

init?<S>(bytes: S, encoding: String.Encoding) where S : Sequence, S.Element == UInt8

Parameters

  • bytes:

    A sequence of bytes to interpret using encoding.

  • encoding:

    The encoding to use to interpret bytes.

See Also

Converting a C String