IntlChar :: charType()function是PHP中的内置函数, 用于获取代码点的常规类别值。此函数返回代码点的常规类别值。
语法如下:
int IntlChar::charType ( $codepoint )
参数:该函数接受单个参数$ codepoint这是强制性的。的$ codepoint值是整数值或字符, 被编码为UTF-8串。
返回值:此函数返回以下列出的常规类别内容:
- IntlChar :: CHAR_CATEGORY_UNASSIGNED
- IntlChar :: CHAR_CATEGORY_GENERAL_OTHER_TYPES
- IntlChar :: CHAR_CATEGORY_UPPERCASE_LETTER
- IntlChar :: CHAR_CATEGORY_LOWERCASE_LETTER
- IntlChar :: CHAR_CATEGORY_TITLECASE_LETTER
- IntlChar :: CHAR_CATEGORY_MODIFIER_LETTER
- IntlChar :: CHAR_CATEGORY_OTHER_LETTER
- IntlChar :: CHAR_CATEGORY_NON_SPACING_MARK
- IntlChar :: CHAR_CATEGORY_ENCLOSING_MARK
- IntlChar :: CHAR_CATEGORY_COMBINING_SPACING_MARK
- IntlChar :: CHAR_CATEGORY_DECIMAL_DIGIT_NUMBER
- IntlChar :: CHAR_CATEGORY_LETTER_NUMBER
- IntlChar :: CHAR_CATEGORY_OTHER_NUMBER
- IntlChar :: CHAR_CATEGORY_SPACE_SEPARATOR
- IntlChar :: CHAR_CATEGORY_LINE_SEPARATOR
- IntlChar :: CHAR_CATEGORY_PARAGRAPH_SEPARATOR
- IntlChar :: CHAR_CATEGORY_CONTROL_CHAR
- IntlChar :: CHAR_CATEGORY_FORMAT_CHAR
- IntlChar :: CHAR_CATEGORY_PRIVATE_USE_CHAR
- IntlChar :: CHAR_CATEGORY_SURROGATE
- IntlChar :: CHAR_CATEGORY_DASH_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_START_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_END_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_CONNECTOR_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_OTHER_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_MATH_SYMBOL
- IntlChar :: CHAR_CATEGORY_CURRENCY_SYMBOL
- IntlChar :: CHAR_CATEGORY_MODIFIER_SYMBOL
- IntlChar :: CHAR_CATEGORY_OTHER_SYMBOL
- IntlChar :: CHAR_CATEGORY_INITIAL_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_FINAL_PUNCTUATION
- IntlChar :: CHAR_CATEGORY_CHAR_CATEGORY_COUNT
程序1:
<
?php// PHP code to illustrate IntlChar::charType()
// function// Input data is character type
var_dump(IntlChar::charType( "A" ) ===
IntlChar::CHAR_CATEGORY_UPPERCASE_LETTER);
// Input data is character type
var_dump(IntlChar::charType( "." ) ===
IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION);
// Input data is character type
var_dump(IntlChar::charType( "\t" ) ===
IntlChar::CHAR_CATEGORY_CONTROL_CHAR);
// Input data is unicode character
var_dump(IntlChar::charType( "\u{2603}" ) ===
IntlChar::CHAR_CATEGORY_OTHER_SYMBOL);
// Input data is string type
var_dump(IntlChar::charType( "ABC" ) ===
IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION);
// Input data is character type
var_dump(IntlChar::charType( "\n" ) ===
IntlChar::CHAR_CATEGORY_CONTROL_CHAR);
?>
输出如下:
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
程式2:
<
?php// PHP code to illustrate IntlChar::charType()
// function// Input data is character type
var_dump(IntlChar::charType( "A" ));
// Input data is character type
var_dump(IntlChar::charType( "." ));
// Input data is character type
var_dump(IntlChar::charType( "\t" ));
// Input data is unicode character
var_dump(IntlChar::charType( "\u{2603}" ));
// Input data is string type
var_dump(IntlChar::charType( "ABC" ));
// Input data is character type
var_dump(IntlChar::charType( "\n" ));
?>
输出如下:
int(1)
int(23)
int(15)
int(27)
NULL
int(15)
【PHP如何使用IntlChar charType()函数()】相关文章:
- PHP | IntlChar :: charDigitValue()函数
- PHP | IntlChar isMirrored()函数
- PHP | IntlChar :: isspace()函数
推荐阅读
- Perl的数组操作(push、pop、shift、unshift)
- PHP如何使用SplFixedArray count()函数(示例)
- Java中抽象类和接口之间有什么区别()
- 如何根据给定的遍历构造BST( |S1)
- 页面布局(CSS如何使用flex属性())
- 多线程编程(C/C++如何使用线程函数())
- 在C ++中将字符串和数字互相转换
- 电脑公司windows7 64位纯净版旗舰最新系统推荐
- 雨林木风ghost win8 64位精简优化版最新系统推荐