📅  最后修改于: 2023-12-03 15:18:24.657000             🧑  作者: Mango
IntlChar::islower()
函数用于检测一个Unicode字符是否为小写字符。
IntlChar::islower($codepoint)
$codepoint
:必选参数,表示要检测的Unicode字符。如果 $codepoint
是小写字符,则返回 TRUE
,否则返回 FALSE
。
// Check if 'a' is a lowercase character
if (IntlChar::islower(ord('a'))) {
echo "'a' is a lowercase character\n";
} else {
echo "'a' is not a lowercase character\n";
}
// Check if 'A' is a lowercase character
if (IntlChar::islower(ord('A'))) {
echo "'A' is a lowercase character\n";
} else {
echo "'A' is not a lowercase character\n";
}
输出结果为:
'a' is a lowercase character
'A' is not a lowercase character
$codepoint
必须是一个有效的Unicode字符编码,可以使用 ord()
函数将字符转换为其对应的Unicode编码。ctype_lower()
函数。