perl6: count chinese characters in string
This is my first post here and it will be a short one.
I was asked to count chinese characters in a string. Most of us know the annoying task of writing an essay with $n words. For chinese it will be $n characters.
Would be a shame if we take this too serious and write too much.
my Str $text = "你好! 我喜欢吃菜
$text ~~ s:g/ \W | \d //;
And that's it.
So why even blog about it? What I think is amazing is that all worked with the first attempt.
I often just try stuff in perl6 without knowing if it will work the way I think it will work.
However most of the time, it just does... and this is why I love this language!
Keep up the great work!!
Thank you for your help！
I would appreciate it if you could let us know the unicode code points for the Chinese characters.