String.UnicodeScalarView

struct String.UnicodeScalarView

A collection of Unicode scalar values that encode a String .

Inheritance CollectionType, DebugPrintable, ExtensibleCollectionType, Printable, RangeReplaceableCollectionType, Reflectable, SequenceType, Sliceable, _CollectionType, _ExtensibleCollectionType, _SequenceType, _Sequence_Type, _Sliceable View Protocol Hierarchy →
Associated Types
Generator = String.UnicodeScalarView.Generator

Type alias inferred.

Element = UnicodeScalar

Type alias inferred.

Index = String.UnicodeScalarView.Index

Type alias inferred.

SubSequence = String.UnicodeScalarView

Type alias inferred.

Nested Types String.UnicodeScalarView.Index, String.UnicodeScalarView.Generator
Import import Swift

Initializers

init()

Construct an empty instance.

Declaration

init()

Instance Variables

var debugDescription: String

Declaration

var debugDescription: String { get }
var description: String

Declaration

var description: String { get }
var endIndex: String.UnicodeScalarView.Index

The "past the end" position.

endIndex is not a valid argument to subscript, and is always reachable from startIndex by zero or more applications of successor().

Declaration

var endIndex: String.UnicodeScalarView.Index { get }
var startIndex: String.UnicodeScalarView.Index

The position of the first UnicodeScalar if the String is non-empty; identical to endIndex otherwise.

Declaration

var startIndex: String.UnicodeScalarView.Index { get }

Subscripts

subscript(_: String.UnicodeScalarView.Index)

Declaration

subscript(position: String.UnicodeScalarView.Index) -> UnicodeScalar { get }
subscript(_: Range<String.UnicodeScalarView.Index>)

Declaration

subscript(r: Range<String.UnicodeScalarView.Index>) -> String.UnicodeScalarView { get }

Instance Methods

mutating func append(_:)

Append x to self.

Complexity: amortized O(1).

Declaration

mutating func append(x: UnicodeScalar)
mutating func extend(_:)

Append the elements of newElements to self.

Complexity: O(length of result)

Declaration

mutating func extend<S : SequenceType where UnicodeScalar == UnicodeScalar>(newElements: S)
func generate()

Return a generator over the UnicodeScalars that comprise this sequence.

Complexity: O(1)

Declaration

func generate() -> String.UnicodeScalarView.Generator
func getMirror()

Returns a mirror that reflects self.

Declaration

func getMirror() -> MirrorType
mutating func insert(_:atIndex:)

Insert newElement at index i.

Invalidates all indices with respect to self.

Complexity: O(count(self)).

Declaration

mutating func insert(newElement: UnicodeScalar, atIndex i: String.UnicodeScalarView.Index)
mutating func removeAll(_:)

Remove all elements.

Invalidates all indices with respect to self.

keepCapacity, if true, prevents the release of allocated storage, which can be a useful optimization when self is going to be grown again.

Declaration

mutating func removeAll(keepCapacity: Bool = default)
mutating func removeAtIndex(_:)

Remove the and return element at index i

Invalidates all indices with respect to self.

Complexity: O(count(self)).

Declaration

mutating func removeAtIndex(i: String.UnicodeScalarView.Index) -> UnicodeScalar
mutating func removeRange(_:)

Remove the indicated subRange of elements

Invalidates all indices with respect to self.

Complexity: O(count(self)).

Declaration

mutating func removeRange(subRange: Range<String.UnicodeScalarView.Index>)
mutating func replaceRange(_:with:)

Replace the given subRange of elements with newElements.

Invalidates all indices with respect to self.

Complexity: O(count(subRange)) if subRange.endIndex == self.endIndex and isEmpty(newElements), O(N) otherwise.

Declaration

mutating func replaceRange<C : CollectionType where UnicodeScalar == UnicodeScalar>(subRange: Range<String.UnicodeScalarView.Index>, with newElements: C)
mutating func reserveCapacity(_:)

Reserve enough space to store n ASCII characters.

Complexity: O(n)

Declaration

mutating func reserveCapacity(n: Int)
mutating func splice(_:atIndex:)

Insert newElements at index i

Invalidates all indices with respect to self.

Complexity: O(count(self) + count(newElements)).

Declaration

mutating func splice<S : CollectionType where UnicodeScalar == UnicodeScalar>(newElements: S, atIndex i: String.UnicodeScalarView.Index)