# Module unicode

This module provides support to handle the Unicode UTF-8 encoding.

# Types

    TRune* = distinct irune

  type that can hold any Unicode character

    TRune16* = distinct int16

  16 bit Unicode character

# Procs

    proc `<=%`*(a, b: TRune): bool

    proc `<%`*(a, b: TRune): bool

    proc `==`*(a, b: TRune): bool

    proc runeLen*(s: string): int {.rtl, extern: "nuc$1".}

  returns the number of Unicode characters of the string s.

    proc runeLenAt*(s: string; i: int): int

  returns the number of bytes the rune starting at `s[i]` takes.

    proc runeAt*(s: string; i: int): TRune

  returns the unicode character in s at byte index i

    proc toUTF8*(c: TRune): string {.rtl, extern: "nuc$1".}

  converts a rune into its UTF8 representation

    proc toLower*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.}

  Converts c into lower case. This works for any Unicode character. If possible, prefer toLower over toUpper.

    proc toUpper*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.}

  Converts c into upper case. This works for any Unicode character. If possible, prefer toLower over toUpper.

    proc toTitle*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.}

    proc isLower*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.}

  returns true iff c is a lower case Unicode character If possible, prefer isLower over isUpper.

    proc isUpper*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.}

  returns true iff c is a upper case Unicode character If possible, prefer isLower over isUpper.

    proc isAlpha*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.}

  returns true iff c is an alpha Unicode character (i.e. a letter)

    proc isTitle*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.}

    proc isWhiteSpace*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.}

  returns true iff c is a Unicode whitespace character

    proc cmpRunesIgnoreCase*(a, b: string): int {.rtl, extern: "nuc$1", procvar.}

  compares two UTF8 strings and ignores the case. Returns:

  0 iff a == b
  < 0 iff a < b
  > 0 iff a > b

# Iterators

    iterator runes*(s: string): TRune

  iterates over any unicode character of the string s.

# Templates

    template fastRuneAt*(s: string; i: int; result: expr; doInc = true)

  Returns the unicode character `s[i]` in result. If `doInc == true` i is incremented by the number of bytes that have been processed.

Generated: 2012-09-23 21:47:54 UTC