<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSString/NSString-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "NSString Implementations"
}
-->

# NSString Implementations

## Topics

### Initializers

[`convenience init?(CString: UnsafePointer<CChar>)`](/documentation/Foundation/NSString/init(CString:)-vkuo)

Initializes the receiver, a newly allocated `NSString` object, by converting the data in a given C-string from the default C-string encoding into the Unicode character encoding.

[`convenience init?(CString: UnsafePointer<CChar>, encoding: UInt)`](/documentation/Foundation/NSString/init(CString:encoding:)-7xice)

[`convenience init?(CString: UnsafePointer<CChar>, encoding: UInt)`](/documentation/Foundation/NSString/init(CString:encoding:)-8229r)

[`convenience init?(CString: UnsafePointer<CChar>, length: Int)`](/documentation/Foundation/NSString/init(CString:length:)-5ure3)

Initializes the receiver, a newly allocated `NSString` object, by converting the data in a given C-string from the default C-string encoding into the Unicode character encoding.

[`convenience init?(CStringNoCopy: UnsafeMutablePointer<CChar>, length: Int, freeWhenDone: Bool)`](/documentation/Foundation/NSString/init(CStringNoCopy:length:freeWhenDone:)-86dm2)

Initializes the receiver, a newly allocated `NSString` object, by converting the data in a given C-string from the default C-string encoding into the Unicode character encoding.

[`convenience init?(UTF8String: UnsafePointer<CChar>)`](/documentation/Foundation/NSString/init(UTF8String:)-321f6)

[`convenience init?(UTF8String: UnsafePointer<CChar>)`](/documentation/Foundation/NSString/init(UTF8String:)-vwmq)

[`convenience init?(contentsOfURL: URL)`](/documentation/Foundation/NSString/init(contentsOfURL:))

Initializes the receiver, a newly allocated `NSString` object, by reading data from the location named by a given URL.

[`convenience init(contentsOfURL: URL, encoding: UInt) throws`](/documentation/Foundation/NSString/init(contentsOfURL:encoding:)-1d0eu)

[`convenience init(contentsOfURL: URL, encoding: UInt) throws`](/documentation/Foundation/NSString/init(contentsOfURL:encoding:)-6iivc)

[`convenience init(contentsOfURL: URL, usedEncoding: UnsafeMutablePointer<UInt>?) throws`](/documentation/Foundation/NSString/init(contentsOfURL:usedEncoding:)-5ekap)

[`convenience init(contentsOfURL: URL, usedEncoding: UnsafeMutablePointer<UInt>?) throws`](/documentation/Foundation/NSString/init(contentsOfURL:usedEncoding:)-86ukw)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)