Unicode

enum Unicode

A namespace for Unicode utilities.

Associated Types
public typealias Encoding = _UnicodeEncoding
public typealias Parser = _UnicodeParser
public typealias Version = (major: Int, minor: Int)
Nested Types Unicode.ASCII, Unicode.Scalar, Unicode.UTF16, Unicode.UTF8, Unicode.ParseResult, Unicode.GeneralCategory, Unicode.CanonicalCombiningClass, Unicode.NumericType, Unicode.UTF32

Cases

case _swift3Buffer Required

Declaration

case _swift3Buffer(: Unicode.UTF16.ForwardParser)
case _swift3Buffer Required

Declaration

case _swift3Buffer(: Unicode.UTF8.ForwardParser)
case _swift3Codec Required

Declaration

case _swift3Codec
case closePunctuation Required

A closing punctuation mark of a pair.

This value corresponds to the category Close_Punctuation (abbreviated Pe) in the Unicode Standard.

Declaration

case closePunctuation
case connectorPunctuation Required

A connecting punctuation mark, like a tie.

This value corresponds to the category Connector_Punctuation (abbreviated Pc) in the Unicode Standard.

Declaration

case connectorPunctuation
case control Required

A C0 or C1 control code.

This value corresponds to the category Control (abbreviated Cc) in the Unicode Standard.

Declaration

case control
case currencySymbol Required

A currency sign.

This value corresponds to the category Currency_Symbol (abbreviated Sc) in the Unicode Standard.

Declaration

case currencySymbol
case dashPunctuation Required

A dash or hyphen punctuation mark.

This value corresponds to the category Dash_Punctuation (abbreviated Pd) in the Unicode Standard.

Declaration

case dashPunctuation
case decimal Required

A digit that is commonly understood to form base-10 numbers.

Specifically, scalars have this numeric type if they occupy a contiguous range of code points representing numeric values 0...9.

Declaration

case decimal
case decimalNumber Required

A decimal digit.

This value corresponds to the category Decimal_Number (abbreviated Nd) in the Unicode Standard.

Declaration

case decimalNumber
case digit Required

A digit that does not meet the requirements of the decimal numeric type.

Scalars with this numeric type are often those that represent a decimal digit but would not typically be used to write a base-10 number, such as "④" (U+2463 CIRCLED DIGIT FOUR).

As of Unicode 6.3, any new scalars that represent numbers but do not meet the requirements of decimal will have numeric type numeric, and programs can treat digit and numeric equivalently.

Declaration

case digit
case emptyInput Required

The input was entirely consumed.

Declaration

case emptyInput
case enclosingMark Required

An enclosing combining mark.

This value corresponds to the category Enclosing_Mark (abbreviated Me) in the Unicode Standard.

Declaration

case enclosingMark
case error Required

An encoding error was detected.

length is the number of underlying code units consumed by this error, guaranteed to be greater than 0.

Declaration

case error(length: Int)
case finalPunctuation Required

A final quotation mark.

This value corresponds to the category Final_Punctuation (abbreviated Pf) in the Unicode Standard.

Declaration

case finalPunctuation
case format Required

A format control character.

This value corresponds to the category Format (abbreviated Cf) in the Unicode Standard.

Declaration

case format
case initialPunctuation Required

An initial quotation mark.

This value corresponds to the category Initial_Punctuation (abbreviated Pi) in the Unicode Standard.

Declaration

case initialPunctuation
case letterNumber Required

A letter-like numeric character.

This value corresponds to the category Letter_Number (abbreviated Nl) in the Unicode Standard.

Declaration

case letterNumber
case lineSeparator Required

A line separator, which is specifically (and only) U+2028 LINE SEPARATOR.

This value corresponds to the category Line_Separator (abbreviated Zl) in the Unicode Standard.

Declaration

case lineSeparator
case lowercaseLetter Required

A lowercase letter.

This value corresponds to the category Lowercase_Letter (abbreviated Ll) in the Unicode Standard.

Declaration

case lowercaseLetter
case mathSymbol Required

A symbol of mathematical use.

This value corresponds to the category Math_Symbol (abbreviated Sm) in the Unicode Standard.

Declaration

case mathSymbol
case modifierLetter Required

A modifier letter.

This value corresponds to the category Modifier_Letter (abbreviated Lm) in the Unicode Standard.

Declaration

case modifierLetter
case modifierSymbol Required

A non-letterlike modifier symbol.

This value corresponds to the category Modifier_Symbol (abbreviated Sk) in the Unicode Standard.

Declaration

case modifierSymbol
case nonspacingMark Required

A non-spacing combining mark with zero advance width (abbreviated Mn).

This value corresponds to the category Nonspacing_Mark (abbreviated Mn) in the Unicode Standard.

Declaration

case nonspacingMark
case numeric Required

A digit that does not meet the requirements of the decimal numeric type or a non-digit numeric value.

This numeric type includes fractions such as "⅕" (U+2155 VULGAR FRACITON ONE FIFTH), numerical CJK ideographs like "兆" (U+5146 CJK UNIFIED IDEOGRAPH-5146), and other scalars that are not decimal digits used positionally in the writing of base-10 numbers.

As of Unicode 6.3, any new scalars that represent numbers but do not meet the requirements of decimal will have numeric type numeric, and programs can treat digit and numeric equivalently.

Declaration

case numeric
case openPunctuation Required

An opening punctuation mark of a pair.

This value corresponds to the category Open_Punctuation (abbreviated Ps) in the Unicode Standard.

Declaration

case openPunctuation
case otherLetter Required

Other letters, including syllables and ideographs.

This value corresponds to the category Other_Letter (abbreviated Lo) in the Unicode Standard.

Declaration

case otherLetter
case otherNumber Required

A numeric character of another type.

This value corresponds to the category Other_Number (abbreviated No) in the Unicode Standard.

Declaration

case otherNumber
case otherPunctuation Required

A punctuation mark of another type.

This value corresponds to the category Other_Punctuation (abbreviated Po) in the Unicode Standard.

Declaration

case otherPunctuation
case otherSymbol Required

A symbol of another type.

This value corresponds to the category Other_Symbol (abbreviated So) in the Unicode Standard.

Declaration

case otherSymbol
case paragraphSeparator Required

A paragraph separator, which is specifically (and only) U+2029 PARAGRAPH SEPARATOR.

This value corresponds to the category Paragraph_Separator (abbreviated Zp) in the Unicode Standard.

Declaration

case paragraphSeparator
case privateUse Required

A private-use character.

This value corresponds to the category Private_Use (abbreviated Co) in the Unicode Standard.

Declaration

case privateUse
case spaceSeparator Required

A space character of non-zero width.

This value corresponds to the category Space_Separator (abbreviated Zs) in the Unicode Standard.

Declaration

case spaceSeparator
case spacingMark Required

A spacing combining mark with positive advance width.

This value corresponds to the category Spacing_Mark (abbreviated Mc) in the Unicode Standard.

Declaration

case spacingMark
case surrogate Required

A surrogate code point.

This value corresponds to the category Surrogate (abbreviated Cs) in the Unicode Standard.

Declaration

case surrogate
case titlecaseLetter Required

A digraph character whose first part is uppercase.

This value corresponds to the category Titlecase_Letter (abbreviated Lt) in the Unicode Standard.

Declaration

case titlecaseLetter
case unassigned Required

A reserved unassigned code point or a non-character.

This value corresponds to the category Unassigned (abbreviated Cn) in the Unicode Standard.

Declaration

case unassigned
case uppercaseLetter Required

An uppercase letter.

This value corresponds to the category Uppercase_Letter (abbreviated Lu) in the Unicode Standard.

Declaration

case uppercaseLetter
case valid Required

A T was parsed successfully

Declaration

case valid(: T)

Initializers

init init(rawValue:) Required

Creates a new canonical combining class with the given raw integer value.

  • Parameter rawValue: The raw integer value of the canonical combining class.

Declaration

public init(rawValue: UInt8)

Instance Variables

var hashValue Required

The hash value.

Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.

Important: hashValue is deprecated as a Hashable requirement. To conform to Hashable, implement the hash(into:) requirement instead.

Declaration

var hashValue: Int
let rawValue Required

The raw integer value of the canonical combining class.

Declaration

let rawValue: UInt8

Instance Methods

func hash(into hasher: inout Hasher) Required

Hashes the essential components of this value by feeding them into the given hasher.

Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type's == operator implementation. Call hasher.combine(_:) with each of these components.

Important: Never call finalize() on hasher. Doing so may become a compile-time error in the future.

  • Parameter hasher: The hasher to use when combining the components of this instance.

Declaration

public func hash(into hasher: inout Hasher)

Type Variables

let above Required

Distinct marks directly above.

Declaration

let above: Unicode.CanonicalCombiningClass
let aboveLeft Required

Distinct marks at the top left.

Declaration

let aboveLeft: Unicode.CanonicalCombiningClass
let aboveRight Required

Distinct marks at the top right.

Declaration

let aboveRight: Unicode.CanonicalCombiningClass
let attachedAbove Required

Marks attached directly above.

Declaration

let attachedAbove: Unicode.CanonicalCombiningClass
let attachedAboveRight Required

Marks attached at the top right.

Declaration

let attachedAboveRight: Unicode.CanonicalCombiningClass
let attachedBelow Required

Marks attached directly below.

Declaration

let attachedBelow: Unicode.CanonicalCombiningClass
let attachedBelowLeft Required

Marks attached at the bottom left.

Declaration

let attachedBelowLeft: Unicode.CanonicalCombiningClass
let below Required

Distinct marks directly below.

Declaration

let below: Unicode.CanonicalCombiningClass
let belowLeft Required

Distinct marks at the bottom left.

Declaration

let belowLeft: Unicode.CanonicalCombiningClass
let belowRight Required

Distinct marks at the bottom right.

Declaration

let belowRight: Unicode.CanonicalCombiningClass
let doubleAbove Required

Distinct marks extending above two bases.

Declaration

let doubleAbove: Unicode.CanonicalCombiningClass
let doubleBelow Required

Distinct marks subtending two bases.

Declaration

let doubleBelow: Unicode.CanonicalCombiningClass
let iotaSubscript Required

Greek iota subscript only (U+0345 COMBINING GREEK YPOGEGRAMMENI).

Declaration

let iotaSubscript: Unicode.CanonicalCombiningClass
let kanaVoicing Required

Combining marks that are attached to hiragana and katakana to indicate voicing changes.

Declaration

let kanaVoicing: Unicode.CanonicalCombiningClass
let left Required

Distinct marks to the left.

Declaration

let left: Unicode.CanonicalCombiningClass
let notReordered Required

Base glyphs that occupy their own space and do not combine with others.

Declaration

let notReordered: Unicode.CanonicalCombiningClass
let nukta Required

Diacritic nukta marks in Brahmi-derived scripts.

Declaration

let nukta: Unicode.CanonicalCombiningClass
let overlay Required

Marks that overlay a base letter or symbol.

Declaration

let overlay: Unicode.CanonicalCombiningClass
let right Required

Distinct marks to the right.

Declaration

let right: Unicode.CanonicalCombiningClass
let virama Required

Diacritic virama marks in Brahmi-derived scripts.

Declaration

let virama: Unicode.CanonicalCombiningClass

Type Methods

func <(lhs: Unicode.CanonicalCombiningClass, rhs: Unicode.CanonicalCombiningClass) -> Bool Required

Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

This function is the only requirement of the Comparable protocol. The remainder of the relational operator functions are implemented by the standard library for any type that conforms to Comparable.

Declaration

public static func <(lhs: Unicode.CanonicalCombiningClass, rhs: Unicode.CanonicalCombiningClass) -> Bool
func ==(lhs: Unicode.CanonicalCombiningClass, rhs: Unicode.CanonicalCombiningClass) -> Bool Required

Returns a Boolean value indicating whether two values are equal.

Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

Declaration

public static func ==(lhs: Unicode.CanonicalCombiningClass, rhs: Unicode.CanonicalCombiningClass) -> Bool