well `"/".runeAt(1)` is defintely a runtime error since there is a single rune 
in that string.

the following does what you want but apparently `unicodedb` misses names for 
first 16 codepoints (it could be probably intended as a possible issue of the 
lib):
    
    
    import strutils
    import unicode
    import unicodedb/names
    
    template echoRune(n: int) =
      let name = Rune(n).name
      if name.len > 0:
        echo "U+", toHex(n, 4), " ", name
    
    for n in 0 .. 0x2A:
      echoRune(n)
    echo "..."
    echoRune(0x03B1)
    
    
    Run

output: 
    
    
    U+0020 SPACE
    U+0021 EXCLAMATION MARK
    U+0022 QUOTATION MARK
    U+0023 NUMBER SIGN
    U+0024 DOLLAR SIGN
    U+0025 PERCENT SIGN
    U+0026 AMPERSAND
    U+0027 APOSTROPHE
    U+0028 LEFT PARENTHESIS
    U+0029 RIGHT PARENTHESIS
    U+002A ASTERISK
    ...
    U+03B1 GREEK SMALL LETTER ALPHA
    
    
    Run

Reply via email to