struct String.Index A character position in a String Inheritance BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, Reflectable, _BidirectionalIndexType, _Comparable, _ForwardIndexType, _Incrementable View Protocol Hierarchy → Import import Swift Initializers init?(_: UTF8Index, within: String) Construct the position in characters that corresponds exactly to utf8Index. If no such position exists, the result is nil. Requires: utf8Index is an element of indices(characters.utf8). Declaration init?(_ utf8Index: UTF8Index, within characters: String) init?(_: UTF16Index, within: String) Construct the position in characters that corresponds exactly to utf16Index. If no such position exists, the result is nil. Requires: utf16Index is an element of indices(characters.utf16). Declaration init?(_ utf16Index: UTF16Index, within characters: String) init?(_: UnicodeScalarIndex, within: String) Construct the position in characters that corresponds exactly to unicodeScalarIndex. If no such position exists, the result is nil. Requires: unicodeScalarIndex is an element of indices(characters.unicodeScalars). Declaration init?(_ unicodeScalarIndex: UnicodeScalarIndex, within characters: String) Instance Methods func getMirror() Returns a mirror that reflects self. Declaration func getMirror() -> MirrorType func predecessor() Returns the previous consecutive value before self. Requires: the previous value is representable. Declaration func predecessor() -> String.Index func samePositionIn(_: String.UTF8View) Return the position in utf8 that corresponds exactly to self. Requires: self is an element of indices(String(utf8)). Declaration func samePositionIn(utf8: String.UTF8View) -> String.UTF8View.Index func samePositionIn(_: String.UTF16View) Return the position in utf16 that corresponds exactly to self. Requires: self is an element of indices(String(utf16)). Declaration func samePositionIn(utf16: String.UTF16View) -> String.UTF16View.Index func samePositionIn(_: String.UnicodeScalarView) Return the position in unicodeScalars that corresponds exactly to self. Requires: self is an element of indices(String(unicodeScalars)). Declaration func samePositionIn(unicodeScalars: String.UnicodeScalarView) -> String.UnicodeScalarView.Index func successor() Returns the next consecutive value after self. Requires: the next value is representable. Declaration func successor() -> String.Index