IntlChar::enumCharTypes() - IntlChar类
IntlChar::enumCharTypes()
版本:php7
(PHP 7)
Enumerate all code points with their Unicode general categories
说明
publicstaticIntlChar::enumCharTypes(callable $callback): voidEnumerates efficiently all code points with their Unicode general categories. This is useful for building data structures, for enumerating all assigned code points, etc.
For each contiguous range of code points with a given general category("character type"), the$callbackfunction is called. Adjacent ranges have different types. The Unicode Standard guarantees that the numeric value of the type is 0..31.
参数
$callbackThe function that is to be called for each contiguous range of code points with the same general category. The following three arguments will be passed into it:
- integer$start- The starting code point of the range
- integer$end- The ending code point of the range
- integer$name- The category type(one of theIntlChar::CHAR_CATEGORY_*constants)
返回值
没有返回值。
范例
Enumerating over a sample range of code points
以上例程会输出:
U+0000 through U+0020 are in category 15 U+0020 through U+0021 are in category 12 U+0021 through U+0024 are in category 23 U+0024 through U+0025 are in category 25 U+0025 through U+0028 are in category 23 U+0028 through U+0029 are in category 20 U+0029 through U+002a are in category 21 U+002a through U+002b are in category 23 U+002b through U+002c are in category 24 U+002c through U+002d are in category 23 U+002d through U+002e are in category 19 U+002e through U+0030 are in category 23 U+0030 through U+003a are in category 9 ...
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!