---
title: "init(utf8String:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsstring/init(utf8string:)-vg2b"
---

# init(utf8String:)

Returns an @c NSString object initialized by copying the characters from a given C array of UTF8-encoded bytes.

## Declaration

```swift
convenience init?(utf8String nullTerminatedCString: UnsafePointer<CChar>)
```

## Parameters

- `nullTerminatedCString`: A @c NULL-terminated C array of bytes in UTF-8 encoding. This value must not be @c NULL.

## Return Value

Return Value An @c NSString object initialized by copying the bytes from @c nullTerminatedCString. The returned object may be different from the original receiver.
