String.UnicodeScalarView.UnicodeScalarIndex

extension String.UnicodeScalarView.UnicodeScalarIndex
Import import Swift

Initializers

init(_:within:)

Construct the position in unicodeScalars that corresponds exactly to characterIndex.

Requires: characterIndex is an element of String(unicodeScalars).indices.

Declaration

init(_ characterIndex: Index, within unicodeScalars: String.UnicodeScalarView)
init?(_: UTF8Index, within: String.UnicodeScalarView)

Construct the position in unicodeScalars that corresponds exactly to utf8Index. If no such position exists, the result is nil.

Requires: utf8Index is an element of String(unicodeScalars).utf8.indices.

Declaration

init?(_ utf8Index: UTF8Index, within unicodeScalars: String.UnicodeScalarView)
init?(_: UTF16Index, within: String.UnicodeScalarView)

Construct the position in unicodeScalars that corresponds exactly to utf16Index. If no such position exists, the result is nil.

Requires: utf16Index is an element of String(unicodeScalars).utf16.indices.

Declaration

init?(_ utf16Index: UTF16Index, within unicodeScalars: String.UnicodeScalarView)

Instance Methods

func samePositionIn(_: String)

Returns the position in characters that corresponds exactly to self, or if no such position exists, nil.

Requires: self is an element of characters.unicodeScalars.indices.

Declaration

func samePositionIn(characters: String) -> Index?
func samePositionIn(_: String.UTF8View)

Returns the position in utf8 that corresponds exactly to self.

Requires: self is an element of String(utf8)!.indices.

Declaration

func samePositionIn(utf8: String.UTF8View) -> String.UTF8View.Index
func samePositionIn(_: String.UTF16View)

Returns the position in utf16 that corresponds exactly to self.

Requires: self is an element of String(utf16)!.indices.

Declaration

func samePositionIn(utf16: String.UTF16View) -> String.UTF16View.Index