struct StaticString
Inheritance |
CustomDebugStringConvertible, CustomStringConvertible, ExtendedGraphemeClusterLiteralConvertible, StringLiteralConvertible, UnicodeScalarLiteralConvertible, _Reflectable
View Protocol Hierarchy →
|
---|---|
Import | import Swift |
Initializers
Declaration
init(_builtinExtendedGraphemeClusterLiteral start: Builtin.RawPointer, byteSize: Builtin.Word, isASCII: Builtin.Int1)
Declaration
init(_builtinStringLiteral start: Builtin.RawPointer, byteSize: Builtin.Word, isASCII: Builtin.Int1)
Declaration
init(_builtinUnicodeScalarLiteral value: Builtin.Int32)
Create an instance initialized to value
.
Declaration
init(extendedGraphemeClusterLiteral value: StaticString)
Create an instance initialized to value
.
Declaration
init(stringLiteral value: StaticString)
Create an instance initialized to value
.
Declaration
init(unicodeScalarLiteral value: StaticString)
Instance Variables
If self
stores a pointer to ASCII or UTF-8 code units, the
length in bytes of that data.
If self
stores a single Unicode scalar value, the value of
byteSize
is unspecified.
Declaration
var byteSize: Int { get }
A textual representation of self
, suitable for debugging.
Declaration
var debugDescription: String { get }
A textual representation of self
.
Declaration
var description: String { get }
true
iff self
stores a pointer to ASCII or UTF-8 code units.
Declaration
var hasPointerRepresentation: Bool { get }
true
if self
stores a pointer to ASCII code units.
If self
stores a single Unicode scalar value, the value of
isASCII
is unspecified.
Declaration
var isASCII: Bool { get }
Returns a String
representing the same sequence of Unicode
scalar values as self
does.
Declaration
var stringValue: String { get }
The stored Unicode scalar value.
Requires: self
stores a single Unicode scalar value.
Declaration
var unicodeScalar: UnicodeScalar { get }
A pointer to the beginning of UTF-8 code units.
Requires: self
stores a pointer to either ASCII or UTF-8 code
units.
Declaration
var utf8Start: UnsafePointer<UInt8> { get }
Instance Methods
Invoke body
with a buffer containing the UTF-8 code units of
self
.
This method works regardless of what self
stores.
Declaration
func withUTF8Buffer<R>(@noescape body: (UnsafeBufferPointer<UInt8>) -> R) -> R
A simple string designed to represent text that is "knowable at compile-time".
Logically speaking, each instance looks something like this: