String.UTF16View.Index

extension String.UTF16View.Index
Inheritance Comparable, Equatable, Strideable View Protocol Hierarchy →
Import import Swift

Initializers

init(_:)

[Foundation] Construct from an integer offset.

Declaration

init(_ offset: Int)

Instance Methods

func advanced(by:)

[Foundation] Returns a Self x such that self.distance(to: x) approximates n.

If Stride conforms to Integer, then self.distance(to: x) == n.

Complexity: O(1).

Declaration

func advanced(by n: Int) -> String.UTF16View.Index
func distance(to:)

[Foundation] Returns a stride x such that self.advanced(by: x) approximates other.

If Stride conforms to Integer, then self.advanced(by: x) == other.

Complexity: O(1).

Declaration

func distance(to other: String.UTF16View.Index) -> Int

Conditionally Inherited Items

The initializers, methods, and properties listed below may be available on this type under certain conditions (such as methods that are available on Array when its elements are Equatable) or may not ever be available if that determination is beyond SwiftDoc.org's capabilities. Please open an issue on GitHub if you see something out of place!

Where Stride : SignedInteger

func ...(_:maximum:)

Returns a countable closed range that contains both of its bounds.

Use the closed range operator (...) to create a closed range of any type that conforms to the Strideable protocol with an associated signed integer Stride type, such as any of the standard library's integer types. This example creates a ClosedRange<Int> from zero up to, and including, nine.

let singleDigits = 0...9
print(singleDigits.contains(9))
// Prints "true"

You can use sequence or collection methods on the singleDigits range.

print(singleDigits.count)
// Prints "10"
print(singleDigits.last)
// Prints "9"

Parameters:)`. minimum: The lower bound for the range. maximum: The upper bound for the range.

Declaration

func ...(minimum: String.UTF16View.Index, maximum: String.UTF16View.Index) -> ClosedRange<String.UTF16View.Index>

Declared In

Strideable