Instance Methodswift 6.0.1Swift
index(before:)
func index(before i: Substring.Index) -> Substring.Index
Other members in extension
Types
Typealiases
Show obsolete interfaces (1)
Hide obsolete interfaces
typealias CharacterView
A view of a string’s contents as a collection of characters.
Type members
init(
) Creates an empty substring.
init(Substring.UnicodeScalarView
) Creates a Substring having the given content.
init(Substring.UTF8View
) Creates a Substring having the given content.
init(Substring.UTF16View
) Creates a Substring having the given content.
init(String
) init<S>(S
) init(cString: UnsafePointer<CChar>
) init<C, Encoding>(decoding: C, as: Encoding.Type
) init<Encoding>(decodingCString: UnsafePointer<Encoding.CodeUnit>, as: Encoding.Type
) init(extendedGraphemeClusterLiteral: String
) init(stringInterpolation: DefaultStringInterpolation
) Creates a new instance from an interpolated string literal.
init(stringLiteral: String
) init(unicodeScalarLiteral: String
) static func ~= (lhs: Substring, rhs: String
) -> Bool
Instance members
var base: String
Returns the underlying string from which this substring was derived.
var customMirror: Mirror
var debugDescription: String
var description: String
var endIndex: Substring.Index
var isContiguousUTF8: Bool
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
var unicodeScalars: Substring.UnicodeScalarView
var utf16: Substring.UTF16View
var utf8: Substring.UTF8View
subscript(Substring.Index
) -> Character subscript(Range<Substring.Index>
) -> Substring func append<S>(contentsOf: S
) func distance(from: Substring.Index, to: Substring.Index
) -> Int func filter((Substring.Element) throws -> Bool
) rethrows -> String func index(Substring.Index, offsetBy: Int
) -> Substring.Index func index(Substring.Index, offsetBy: Int, limitedBy: Substring.Index
) -> Substring.Index? func index(after: Substring.Index
) -> Substring.Index func lowercased(
) -> String func makeContiguousUTF8(
) If this string is not contiguous, make it so. If this mutates the substring, it will invalidate any pre-existing indices.
func replaceSubrange(Range<Substring.Index>, with: Substring
) func replaceSubrange<C>(Range<Substring.Index>, with: C
) func uppercased(
) -> String func withCString<Result>((UnsafePointer<CChar>) throws -> Result
) rethrows -> Result func withCString<Result, TargetEncoding>(encodedAs: TargetEncoding.Type, (UnsafePointer<TargetEncoding.CodeUnit>) throws -> Result
) rethrows -> Result func withUTF8<R>((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.func write(String
) func write<Target>(to: inout Target
)
Show obsolete interfaces (3)
Hide obsolete interfaces
var characters: Substring
A view of the string’s contents as a collection of characters.
var customPlaygroundQuickLook: _PlaygroundQuickLook
func withMutableCharacters<R>((inout Substring) -> R
) -> R Applies the given closure to a mutable view of the string’s characters.