This trick is very useful if you need to find all code points with given name or property. Let's find all characters that have ogonek (tiny tail) from previous post.
$ raku -e 'for 1..1_112_064 { next unless .uniname.contains( "WITH OGONEK" ); say .chr, " ", .uniname;}'Ą LATIN CAPITAL LETTER A WITH OGONEKą LATIN SMALL LETTER A WITH OGONEKĘ LATIN CAPITAL LETTER E WITH OGONEKę LATIN SMALL LETTER E WITH OGONEKĮ LATIN CAPITAL LETTER I WITH OGONEKį LATIN SMALL LETTER I WITH OGONEKŲ LATIN CAPITAL LETTER U WITH OGONEKų LATIN SMALL LETTER U WITH OGONEKǪ LATIN CAPITAL LETTER O WITH OGONEKǫ LATIN SMALL LETTER O WITH OGONEKǬ LATIN CAPITAL LETTER O WITH OGONEK AND MACRONǭ LATIN SMALL LETTER O WITH OGONEK AND MACRON
InRaku you can calluniname
orchr
methods on integer value directly to get code point name or character under this code point respectively. If you are not familiar with.method
syntax - this is just a lazy way to call a method inside a block on whatever value your iteration is at the moment, without assigning it explicitly to named variable. If you want you can be more explicit about it like:for 1..1_112_064 -> $codepoint { next unless $codepoint.uniname... }
.
Did you know that:
- There are899 digits defined in Unicode?
$ raku -e '( 1 .. 1_112_064 ).grep( *.uniname.contains( "DIGIT" ) ).elems.say;'899
- There are154 sentence terminals?
$ raku -e '( 1 .. 1_112_064 ).grep( *.uniprop( "Sentence_Terminal" ) ).elems.say;'154
(Unicode properties will be explained in next post)
- Within those 154 sentence terminals there are22 question marks?
$ raku -e 'for 1 .. 1_112_064 { next unless .uniname.ends-with( "QUESTION MARK" ); say .chr, " ", .uniname; }'? QUESTION MARK¿ INVERTED QUESTION MARK; GREEK QUESTION MARK՞ ARMENIAN QUESTION MARK؟ ARABIC QUESTION MARK፧ ETHIOPIC QUESTION MARK᥅ LIMBU QUESTION MARK...
So, what was the funniest thing you found in Unicode?¿⸮
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse