Instance Property


A null-terminated UTF8 representation of the string.


var utf8String: UnsafePointer<Int8>? { get }


This C string is a pointer to a structure inside the string object, which may have a lifetime shorter than the string object and will certainly not have a longer lifetime. Therefore, you should copy the C string if it needs to be stored outside of the memory context in which you use this property.

See Also

Getting C Strings

func cString(using: UInt)

Returns a representation of the receiver as a C string using a given encoding.

func getCString(UnsafeMutablePointer<Int8>, maxLength: Int, encoding: UInt)

Converts the receiver’s content to a given encoding and stores them in a buffer.