Returns an NSString
object initialized by copying the characters from a given C array of UTF8-encoded bytes.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
convenience init?(utf8String nullTerminatedCString: Unsafe Pointer<Int8>)
Parameters
nullTerminatedCString
A
NULL
-terminated C array of bytes in UTF-8 encoding. This value must not beNULL
.Important
Raises an exception if
null
isTerminated CString NULL
.
Return Value
An NSString
object initialized by copying the bytes from null
. The returned object may be different from the original receiver.