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 == UInt8Parameters
- bytes:
A sequence of bytes to interpret using
encoding. - encoding:
The encoding to use to interpret
bytes.