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

Type alias inferred.

Type alias inferred.

Type alias inferred.

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 startIndex: String.UnicodeScalarView.Index

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

Declaration

Subscripts

Instance Methods

mutating func append(_:)

Append x to self.

Complexity: amortized O(1).

Declaration

mutating func extend(_:)

Append the elements of newElements to self.

Complexity: O(length of result)

Declaration

func generate()

Return a generator over the UnicodeScalars that comprise this sequence.

Complexity: O(1)

Declaration

func getMirror()

Returns a mirror that reflects self.

Declaration

mutating func insert(_:atIndex:)

Insert newElement at index i.

Invalidates all indices with respect to self.

Complexity: O(count(self)).

Declaration

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 removeRange(_:)

Remove the indicated subRange of elements

Invalidates all indices with respect to self.

Complexity: O(count(self)).

Declaration

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 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