📜  PHP IntlChar 函数完整参考(1)

📅  最后修改于: 2023-12-03 15:33:29.731000             🧑  作者: Mango

PHP IntlChar 函数完整参考

简介

PHP IntlChar 函数库提供了一组用于Unicode字符的操作和属性的函数。

用法
安装

PHP IntlChar 函数库是PHP的标准扩展,所以在PHP安装过程中就已经包含了它。

使用

可以在PHP脚本中使用IntlChar函数库的函数来处理Unicode字符。以下是一些参考用法示例:

// 判断一个字符是否是字母
if (IntlChar::isalpha($char)) {
  // Do something...
}

// 将一个字符转换为小写
$lowercase_char = IntlChar::tolower($char);

// 获取一个字符的名称
$char_name = IntlChar::charName($char);

// 将字符串中的每个字符转换为大写
$uppercase_str = IntlChar::strtoupper($str);
函数列表

以下是IntlChar函数库的完整函数列表:

Unicode 版本信息
  • IntlChar::getUnicodeVersion()
  • IntlChar::charAge(int $codepoint)
  • IntlChar::getFC_NFKC_Closure(int $codepoint)
字符类型
  • IntlChar::charType(int $codepoint)
  • IntlChar::isalnum(mixed $codepoint)
  • IntlChar::isalpha(mixed $codepoint)
  • IntlChar::isbase(mixed $codepoint)
  • IntlChar::isblank(mixed $codepoint)
  • IntlChar::iscntrl(mixed $codepoint)
  • IntlChar::isdefined(mixed $codepoint)
  • IntlChar::isdigit(mixed $codepoint)
  • IntlChar::isgraph(mixed $codepoint)
  • IntlChar::isIDI(mixed $codepoint)
  • IntlChar::isIDContinue(mixed $codepoint)
  • IntlChar::isIDStart(mixed $codepoint)
  • IntlChar::isISOControl(mixed $codepoint)
  • IntlChar::isjavaidpart(mixed $codepoint)
  • IntlChar::isjavaidstart(mixed $codepoint)
  • IntlChar::isJavaSpaceChar(mixed $codepoint)
  • IntlChar::islower(mixed $codepoint)
  • IntlChar::isMirrored(mixed $codepoint)
  • IntlChar::isprint(mixed $codepoint)
  • IntlChar::ispunct(mixed $codepoint)
  • IntlChar::isspace(mixed $codepoint)
  • IntlChar::istitle(mixed $codepoint)
  • IntlChar::isUAlphabetic(mixed $codepoint)
  • IntlChar::isULowercase(mixed $codepoint)
  • IntlChar::isUUppercase(mixed $codepoint)
  • IntlChar::isupper(mixed $codepoint)
  • IntlChar::isUWhiteSpace(mixed $codepoint)
  • IntlChar::isWhitespace(mixed $codepoint)
字符大小写转换
  • IntlChar::tolower(mixed $codepoint)
  • IntlChar::toupper(mixed $codepoint)
  • IntlChar::totitle(mixed $codepoint)
字符名称和描述
  • IntlChar::charName(mixed $codepoint[, int $nameChoice = IntlChar::UNICODE_CHAR_NAME])
  • IntlChar::getBlockCode(mixed $codepoint)
  • IntlChar::getBlockName(mixed $codepoint)
  • IntlChar::getDerivedCoreProperties(mixed $codepoint)
  • IntlChar::getName(mixed $codepoint[, mixed $isChoice])
  • IntlChar::getUnicodeVersion()
  • IntlChar::enumCharNames(callback $fn, [, mixed $start = 0[, mixed $limit = IntlChar::CODEPOINT_MAX[, int $nameChoice = IntlChar::UNICODE_CHAR_NAME]]])
  • IntlChar::charFromName(string $name[, int $nameChoice = IntlChar::UNICODE_CHAR_NAME])
  • IntlChar::charMirror(mixed $codepoint)
  • IntlChar::charType(mixed $codepoint)
  • IntlChar::getBlockCode(mixed $codepoint)
字符属性
  • IntlChar::getIntPropertyMaxValue(int $property)
  • IntlChar::getIntPropertyMinValue(int $property)
  • IntlChar::getUnicodeVersion()
  • IntlChar::enumCharTypes(callback $fn)
  • IntlChar::getPropertyEnum(int $alias)
字符成对匹配
  • IntlChar::getBidiPairedBracket(mixed $codepoint)
  • IntlChar::getCombiningClass(int $codepoint)
  • IntlChar::getFC_NFKC_Closure(int $codepoint)
数字属性
  • IntlChar::digit(mixed $codepoint[, int $radix = 10])
  • IntlChar::forDigit(mixed $digit[, int $radix = 10])
字符串操作
  • IntlChar::charFromUTF32(mixed $codepoint)
  • IntlChar::UTF32FromChar(mixed $character)
  • IntlChar::charLength(mixed $codepoint)
  • IntlChar::ord(string $character[, int $position = 0])
  • IntlChar::chr(int $codepoint)
  • IntlChar::strchr(string $haystack, mixed $needle, bool $before_needle = FALSE)
结论

以上是PHP IntlChar函数库的完整参考,提供了许多用于操作Unicode字符的强大函数。无论是处理字符的类型、转换字符大小写,或是匹配字符成对等操作,IntlChar函数库都可以为程序员提供可靠的支持。