jjmerelo
jjmerelo

Reputation: 23537

How can you search Unicode codepoints by name in Perl6?

If you already know the name of the codepoint, such as GREEK SMALL LETTER PHI, you can obtain the character using \c. There is an equivalent NQP in getunicode. However, is there a way of looking up all GREEK SMALL LETTER, for instance? I have tried to find out where those names are stored, but I haven't found them in NQP, Rakudo or MoarVM source. Any idea?

Upvotes: 2

Views: 60

Answers (1)

Brad Gilbert
Brad Gilbert

Reputation: 34120

You can just go through all of Unicode codepoints, and test them

(0..0x10FFFF).grep: *.uniname.starts-with('GREEK SMALL LETTER ');

You might want to get the values that are Greek and lowercase instead of only the ones that have GREEK SMALL LETTER in their name.

(0..0x10FFFF).grep: {
  .uniprop('Script') eq 'Greek'
  and
  .uniprop('Lowercase')
}

Upvotes: 2

Related Questions