本文整理汇总了PHP中Zend_Locale_Format::_getRegexForType方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Locale_Format::_getRegexForType方法的具体用法?PHP Zend_Locale_Format::_getRegexForType怎么用?PHP Zend_Locale_Format::_getRegexForType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Locale_Format
的用法示例。
在下文中一共展示了Zend_Locale_Format::_getRegexForType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isNumber
/**
* Checks if the input contains a normalized or localized number
*
* @param string $input Localized number string
* @param array $options Options: locale. See {@link setOptions()} for details.
* @return boolean Returns true if a number was found
*/
public static function isNumber($input, array $options = array())
{
if (!self::_getUniCodeSupport()) {
trigger_error("Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core", E_USER_NOTICE);
}
$options = self::_checkOptions($options) + self::$_options;
// Get correct signs for this locale
$symbols = Zend_Locale_Data::getList($options['locale'], 'symbols');
$regexs = Zend_Locale_Format::_getRegexForType('decimalnumber', $options);
$regexs = array_merge($regexs, Zend_Locale_Format::_getRegexForType('scientificnumber', $options));
if (!empty($input) && $input[0] == $symbols['decimal']) {
$input = 0 . $input;
}
foreach ($regexs as $regex) {
preg_match($regex, $input, $found);
if (isset($found[0])) {
return true;
}
}
return false;
}
示例2: isNumber
/**
* Checks if the input contains a normalized or localized number
*
* @param string $input Localized number string
* @param array $options Options: locale. See {@link setOptions()} for details.
* @return boolean Returns true if a number was found
*/
public static function isNumber($input, array $options = array())
{
$options = self::_checkOptions($options) + self::$_options;
// Get correct signs for this locale
$symbols = Zend_Locale_Data::getList($options['locale'], 'symbols');
$regexs = Zend_Locale_Format::_getRegexForType('decimalnumber', $options);
$regexs = array_merge($regexs, Zend_Locale_Format::_getRegexForType('scientificnumber', $options));
if (!empty($input) && $input[0] == $symbols['decimal']) {
$input = 0 . $input;
}
foreach ($regexs as $regex) {
preg_match($regex, $input, $found);
if (isset($found[0])) {
return true;
}
}
return false;
}