Required Instance Propertyswift 6.2.4Swift
utf8
var utf8: Self.UTF8View { get }var utf8: Self.UTF8View { get }import Swiftprotocol StringProtocol : BidirectionalCollection, Comparable, ExpressibleByStringInterpolation, Hashable, LosslessStringConvertible, TextOutputStream, TextOutputStreamable where Self.Element == Character, Self.Index == String.Index, Self.StringInterpolation == DefaultStringInterpolation, Self.SubSequence : StringProtocolA type that can represent a string as a collection of characters.
associatedtype UTF8View : Collection where Self.UTF8View.Element == UInt8, Self.UTF8View.Index == String.Indexassociatedtype SubSequence = Substringassociatedtype UTF16View : BidirectionalCollection where Self.UTF16View.Element == UInt16, Self.UTF16View.Index == String.Indexassociatedtype UnicodeScalarView : BidirectionalCollection where Self.UnicodeScalarView.Element == Unicode.Scalar, Self.UnicodeScalarView.Index == String.Indexinit(cString nullTerminatedUTF8: UnsafePointer<CChar>) Creates a string from the null-terminated, UTF-8 encoded sequence of bytes at the given pointer.
init<C, Encoding>(decoding codeUnits: C, as sourceEncoding: Encoding.Type) where C : Collection, Encoding : _UnicodeEncoding, C.Element == Encoding.CodeUnit Creates a string from the given Unicode code units in the specified encoding.
init<Encoding>(decodingCString nullTerminatedCodeUnits: UnsafePointer<Encoding.CodeUnit>, as sourceEncoding: Encoding.Type) where Encoding : _UnicodeEncoding Creates a string from the null-terminated sequence of bytes at the given pointer.
var unicodeScalars: Self.UnicodeScalarView { get }var utf16: Self.UTF16View { get }func hasPrefix(_ prefix: String) -> Bool func hasSuffix(_ suffix: String) -> Bool func lowercased() -> String func uppercased() -> String func withCString<Result>(_ body: (UnsafePointer<CChar>) throws -> Result) rethrows -> Result Calls the given closure with a pointer to the contents of the string, represented as a null-terminated sequence of UTF-8 code units.
func withCString<Result, Encoding>(encodedAs targetEncoding: Encoding.Type, _ body: (UnsafePointer<Encoding.CodeUnit>) throws -> Result) rethrows -> Result where Encoding : _UnicodeEncoding Calls the given closure with a pointer to the contents of the string, represented as a null-terminated sequence of code units.