customPlaygroundQuickLook
This declaration was deprecated in Swift 4.2: Substring.customPlaygroundQuickLook will be removed in a future Swift version
var customPlaygroundQuickLook: _PlaygroundQuickLook { get }
This declaration was deprecated in Swift 4.2: Substring.customPlaygroundQuickLook will be removed in a future Swift version
var customPlaygroundQuickLook: _PlaygroundQuickLook { get }
import Swift
@frozen struct Substring
A slice of a string.
init()
Creates an empty substring.
init(_ content: Substring.UnicodeScalarView)
Creates a Substring having the given content.
init(_ content: Substring.UTF8View)
Creates a Substring having the given content.
init(_ content: Substring.UTF16View)
Creates a Substring having the given content.
init(_ content: String)
init<S>(_ elements: S) where S : Sequence, S.Element == Character
init(cString nullTerminatedUTF8: UnsafePointer<CChar>)
init<C, Encoding>(decoding codeUnits: C, as sourceEncoding: Encoding.Type) where C : Collection, Encoding : _UnicodeEncoding, C.Element == Encoding.CodeUnit
init<Encoding>(decodingCString nullTerminatedCodeUnits: UnsafePointer<Encoding.CodeUnit>, as sourceEncoding: Encoding.Type) where Encoding : _UnicodeEncoding
init(extendedGraphemeClusterLiteral value: String)
init(stringInterpolation: DefaultStringInterpolation)
Creates a new instance from an interpolated string literal.
init(stringLiteral value: String)
init(unicodeScalarLiteral value: String)
var base: String { get }
Returns the underlying string from which this substring was derived.
var customMirror: Mirror { get }
var debugDescription: String { get }
var description: String { get }
var endIndex: Substring.Index { get }
var isContiguousUTF8: Bool { get }
Returns whether this string is capable of providing access to validly-encoded UTF-8 contents in contiguous memory in O(1) time.
var startIndex: Substring.Index { get }
var unicodeScalars: Substring.UnicodeScalarView { get set }
var utf16: Substring.UTF16View { get set }
var utf8: Substring.UTF8View { get set }
subscript(i: Substring.Index) -> Character { get }
subscript(r: Range<Substring.Index>) -> Substring { get }
static func ~= (lhs: Substring, rhs: String) -> Bool
mutating func append<S>(contentsOf elements: S) where S : Sequence, S.Element == Character
func distance(from start: Substring.Index, to end: Substring.Index) -> Int
func filter(_ isIncluded: (Substring.Element) throws -> Bool) rethrows -> String
func index(_ i: Substring.Index, offsetBy distance: Int) -> Substring.Index
func index(_ i: Substring.Index, offsetBy distance: Int, limitedBy limit: Substring.Index) -> Substring.Index?
func index(after i: Substring.Index) -> Substring.Index
func index(before i: Substring.Index) -> Substring.Index
func lowercased() -> String
mutating func makeContiguousUTF8()
If this string is not contiguous, make it so. If this mutates the substring, it will invalidate any pre-existing indices.
mutating func replaceSubrange(_ subrange: Range<Substring.Index>, with newElements: Substring)
mutating func replaceSubrange<C>(_ subrange: Range<Substring.Index>, with newElements: C) where C : Collection, C.Element == Character
func uppercased() -> String
func withCString<Result>(_ body: (UnsafePointer<CChar>) throws -> Result) rethrows -> Result
func withCString<Result, TargetEncoding>(encodedAs targetEncoding: TargetEncoding.Type, _ body: (UnsafePointer<TargetEncoding.CodeUnit>) throws -> Result) rethrows -> Result where TargetEncoding : _UnicodeEncoding
mutating func withUTF8<R>(_ body: (UnsafeBufferPointer<UInt8>) throws -> R) rethrows -> R
Runs body
over the content of this substring in contiguous memory. If this substring is not contiguous, this will first make it contiguous, which will also speed up subsequent access. If this mutates the substring, it will invalidate any pre-existing indices.
mutating func write(_ other: String)
func write<Target>(to target: inout Target) where Target : TextOutputStream
@frozen struct UTF16View
@frozen struct UTF8View
@frozen struct UnicodeScalarView
typealias Index = String.Index
typealias SubSequence = Substring
var characters: Substring { get set }
A view of the string’s contents as a collection of characters.
mutating func withMutableCharacters<R>(_ body: (inout Substring) -> R) -> R
Applies the given closure to a mutable view of the string’s characters.
typealias CharacterView = Substring
A view of a string’s contents as a collection of characters.