Character

struct Character

Character represents some Unicode grapheme cluster as defined by a canonical, localized, or otherwise tailored segmentation algorithm.

Inheritance Comparable, CustomDebugStringConvertible, Equatable, ExtendedGraphemeClusterLiteralConvertible, Hashable, Streamable, UnicodeScalarLiteralConvertible, _Reflectable View Protocol Hierarchy →
Import import Swift

Initializers

init(_: String)

Create an instance from a single-character String.

Requires: s contains exactly one extended grapheme cluster.

Declaration

init(_ s: String)
init(_: UnicodeScalar)

Construct a Character containing just the given scalar.

Declaration

init(_ scalar: UnicodeScalar)
init(_builtinExtendedGraphemeClusterLiteral:byteSize:isASCII:)

Declaration

init(_builtinExtendedGraphemeClusterLiteral start: Builtin.RawPointer, byteSize: Builtin.Word, isASCII: Builtin.Int1)
init(_builtinUnicodeScalarLiteral:)

Declaration

init(_builtinUnicodeScalarLiteral value: Builtin.Int32)
init(extendedGraphemeClusterLiteral:)

Create an instance initialized to value.

Declaration

init(extendedGraphemeClusterLiteral value: Character)
init(unicodeScalarLiteral:)

Create an instance initialized to value.

Declaration

init(unicodeScalarLiteral value: Character)

Instance Variables

var debugDescription: String

A textual representation of self, suitable for debugging.

Declaration

var debugDescription: String { get }
var hashValue: Int

The hash value.

Axiom: x == y implies x.hashValue == y.hashValue.

Note: The hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs.

Declaration

var hashValue: Int { get }

Instance Methods

func writeTo(inout:)

Write a textual representation of self into target.

Declaration

func writeTo<Target : OutputStreamType>(inout target: Target)