IntlChar::getPropertyValueEnum() - IntlChar类
IntlChar::getPropertyValueEnum()
版本:php7
(PHP 7)
Get the property value for a given value name
说明
publicstaticIntlChar::getPropertyValueEnum(int $property,string $name): intReturns the property value integer for a given value name, as specified in the Unicode database file PropertyValueAliases.txt. Short, long, and any other variants are recognized.
Note:
Some of the names in PropertyValueAliases.txt will only be recognized withIntlChar::PROPERTY_GENERAL_CATEGORY_MASK
, notIntlChar::PROPERTY_GENERAL_CATEGORY
. These include:
- "C"/ "Other"
- "L"/ "Letter"
- "LC"/ "Cased_Letter"
- "M"/ "Mark"
- "N"/ "Number"
- "P"/ "Punctuation"
- "S"/ "Symbol"
- "Z"/ "Separator"
参数
$propertyThe Unicode property to lookup(see theIntlChar::PROPERTY_*constants).
If out of range, or this method doesn't work with the given value,IntlChar::PROPERTY_INVALID_CODE
is returned.
The value name to be matched. The name is compared using "loose matching" as described in PropertyValueAliases.txt.
返回值
Returns the corresponding value integer, orIntlChar::PROPERTY_INVALID_CODE
if the given name does not match any value of the given property, or if the property is invalid.
范例
Testing different properties
以上例程会输出:
bool(true) bool(true) bool(true) bool(true)