如何获取具有给定属性的所有 Unicode 字符的列表? [英] How do I get a list of all Unicode characters that have a given property?

查看:52
本文介绍了如何获取具有给定属性的所有 Unicode 字符的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不循环遍历整个 Unicode 字符范围,如何获取具有给定属性的字符列表?特别是我想要一个包含所有数字字符的列表(即那些匹配 /\d/ 的字符).我看过Unicode::UCD,它是对于确定给定字符的属性很有用,但似乎没有办法从中获取具有属性的列表字符.

Without looping over the entire range of Unicode characters, how can I get a list of characters that have a given property? In particular I want a list of all characters that are digits (i.e. those that match /\d/). I have looked at Unicode::UCD, and it is useful for determining the properties of a given character, but there doesn't seem to be a way to get a list characters that have a property out of it.

推荐答案

每个类的 Unicode 字符列表是在编译 Perl 时根据 Unicode 规范生成的,通常存储在/usr/lib/perl-YOURPERLVERSION/unicore/lib/gc_sc/

The list of Unicode characters for each class is generated from the Unicode spec when you compile Perl, and is typically stored in /usr/lib/perl-YOURPERLVERSION/unicore/lib/gc_sc/

例如,匹配 IsDigit(又名 \d)的 Unicode 字符范围列表存储在文件/usr/lib/perl-YOURPERLVERSION/unicore/lib/gc_sc/Digit.pl 中

For example, the list of Unicode character ranges that match IsDigit (a.k.a. \d) is stored in the file /usr/lib/perl-YOURPERLVERSION/unicore/lib/gc_sc/Digit.pl

这篇关于如何获取具有给定属性的所有 Unicode 字符的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆