Unicode.Set.to_utf8_char

You're seeing just the function to_utf8_char, go back to Unicode.Set module for more information.
Link to this function

to_utf8_char(unicode_set)

View Source

Specs

to_utf8_char(binary()) :: {:ok, nimble_list()} | {:error, {module(), binary()}}

Transforms a Unicode Set into a list of codepoints that can be used with nimble_parsec.

THe list of codepoints can be used as an argument to NimbleParsec.utf8_char/1.

Arguments

  • unicode_set is a string representation of a Unicode Set

Returns

  • {:ok, list_of_codepints} or

  • {:error, {exception, reason}}

Example

    iex> pattern = Unicode.Set.to_utf8_char "[[:digit:]-[:Zs]]"
    {:ok,
     [48..57, 1632..1641, 1776..1785, 1984..1993, 2406..2415, 2534..2543,
      2662..2671, 2790..2799, 2918..2927, 3046..3055, 3174..3183, 3302..3311,
      3430..3439, 3558..3567, 3664..3673, 3792..3801, 3872..3881, 4160..4169,
      4240..4249, 6112..6121, 6160..6169, 6470..6479, 6608..6617, 6784..6793,
      6800..6809, 6992..7001, 7088..7097, 7232..7241, 7248..7257, 42528..42537,
      43216..43225, 43264..43273, 43472..43481, 43504..43513, 43600..43609,
      44016..44025, 65296..65305, 66720..66729, 68912..68921, 69734..69743,
      69872..69881, 69942..69951, 70096..70105, 70384..70393, 70736..70745,
      70864..70873, 71248..71257, 71360..71369, ...]}