struct String.UTF16View.Index
Inheritance |
BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, _Incrementable
View Protocol Hierarchy →
|
---|---|
Associated Types | |
Import | import Swift |
Initializers
Construct the position in utf16
that corresponds exactly to
characterIndex
.
Requires: characterIndex
is an element of
String(utf16)!.indices
.
Declaration
init(_ characterIndex: Index, within utf16: String.UTF16View)
Construct the position in utf16
that corresponds exactly to
unicodeScalarIndex
.
Requires: unicodeScalarIndex
is an element of
String(utf16)!.unicodeScalars.indices
.
Declaration
init(_ unicodeScalarIndex: UnicodeScalarIndex, within utf16: String.UTF16View)
Construct the position in utf16
that corresponds exactly to
utf8Index
. If no such position exists, the result is nil
.
Requires: utf8Index
is an element of
String(utf16)!.utf8.indices
.
Declaration
init?(_ utf8Index: UTF8Index, within utf16: String.UTF16View)
Instance Methods
Declaration
func advancedBy(n: Distance) -> String.UTF16View.Index
Declared In
String.UTF16View.Index
, BidirectionalIndexType
, ForwardIndexType
Declaration
func advancedBy(n: Distance, limit: String.UTF16View.Index) -> String.UTF16View.Index
Declared In
String.UTF16View.Index
, BidirectionalIndexType
, ForwardIndexType
Declaration
func distanceTo(end: String.UTF16View.Index) -> Distance
Declared In
String.UTF16View.Index
, BidirectionalIndexType
, ForwardIndexType
Returns the position in characters
that corresponds exactly
to self
, or if no such position exists, nil
.
Requires: self
is an element of characters.utf16.indices
.
Declaration
func samePositionIn(characters: String) -> Index?
Returns the position in utf8
that corresponds exactly
to self
, or if no such position exists, nil
.
Requires: self
is an element of
String(utf8)!.utf16.indices
.
Declaration
func samePositionIn(utf8: String.UTF8View) -> String.UTF8View.Index?
Returns the position in unicodeScalars
that corresponds exactly
to self
, or if no such position exists, nil
.
Requires: self
is an element of
String(unicodeScalars).utf16.indices
.
Declaration
func samePositionIn(unicodeScalars: String.UnicodeScalarView) -> UnicodeScalarIndex?
A position in a string's collection of UTF-16 code units.