Structure

String.Iterator

A type that provides the collection’s iteration interface and encapsulates its iteration state.

Declaration

@frozen struct Iterator

Overview

By default, a collection conforms to the Sequence protocol by supplying IndexingIterator as its associated Iterator type.

Topics

Type Aliases

typealias String.Iterator.Element

The type of element traversed by the iterator.

Instance Methods

func next() -> Character?

Advances to the next element and returns it, or nil if no next element exists.

Relationships

From Protocol

See Also

Related String Types

struct Substring

A slice of a string.

protocol StringProtocol

A type that can represent a string as a collection of characters.

struct String.Index

A position of a character or code unit in a string.

struct String.UnicodeScalarView

A view of a string’s contents as a collection of Unicode scalar values.

struct String.UTF16View

A view of a string’s contents as a collection of UTF-16 code units.

struct String.UTF8View

A view of a string’s contents as a collection of UTF-8 code units.